Front End Posting with WordPress

In this tutorial I am going to discuss how to insert posts via the front end of a WordPress blog. This tutorial will also cover some validation techniques, setting the post as “pending”, and email notification when a new post is created. So let’s begin!

First, you would want to create a new page, let’s call it “Add Article” with a slug of “add-article”. Make sure that your permalink settings it set to “/%postname%/”

Create a PHP file: page-add-article.php. Test this page, it should show a blank white screen.
Continue Reading…

Magento codepools

Magento has three different codepools:



Core pool

This core pool folder stores all the code that makes Magento so powerful, flexible and lovely. The chief rule of Magento development is that you should never make any changes in the core pool.

Community pool

This folder belongs entirely to community developers. This is the right place for hundreds of 3rd party extensions, both free and paid, that can be found at MagentoConnect. So basically, if you have installed any extension, it must be in app/code/community/ only.

Local pool

If you have your own Magento-based store and want to make everything by yourself or you are a Magento developer and have a purpose to change the logic somehow, local pool is the place where everything should be done. If you want to override Magento extensions, blocks or methods, copy the necessary folders from the Core pool and do whatever you are inclined to do. Apply the same rule for custom extensions that are created specifically for the website – all code should be in local pool.

How does the framework interact with the various codepools?

To identify the proccess let’s take a look at app/Mage.php

* Set include path
$paths[] = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘local’;
$paths[] = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘community’;
$paths[] = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘core’;
$paths[] = BP . DS . ‘lib’;
$appPath = implode(PS, $paths);
set_include_path($appPath . PS . Mage::registry(‘original_include_path’));
include_once “Mage/Core/functions.php”;
include_once “Varien/Autoload.php”;
This code snippet illustrates the order Magento is using to include paths – firstly it includes Local code pool, than community and after that – core, which allow developers to override classes without changing core files.

How to get distance between two places using Google Maps

Are you looking for getting distance between two places using google map, just use the below php code for action.

Use curl to use google map api to get the distance.
Here the format of address
$address = $value[“street”].” “.$value[“region”].” “.$value[“country_id”].” “.$value[“zip_code”];

Now just paste the code

$url = “”.str_replace(‘ ‘, ‘+’, $source_address).”&destination=”.str_replace(‘ ‘, ‘+’, $destination_address).”&sensor=false”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
$response_all = json_decode($response);
// print_r($response);
$distance = $response_all->routes[0]->legs[0]->distance->text;

How to Call Static Block from CMS Pages in Magento

I have come to many situation to call static block from CMS Pages, and i am using the below code to do this trick. You can use this code to call a static block on any of your CMS page like homepage so you just follow the steps
Go To CMS->Pages
Select Your page

Go To Design->Layout Update XML
Reference means the block will call on left right or Content


In case if reference already there then just use


Enjoy πŸ™‚

magento check for home page

Here is the tip for you to check for homepage in Magento. I had come across a situation to add a banner block conditionally on the homepage. The below code helps me to accomplish the same. Hope this will help you too.

Mage::getSingleton('cms/page')->getIdentifier() == 'home'  &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' 
) :

How to display a menu with categories, sub-categories in Magento

If you need to display a custom menu based on your categories, subcategories in magento, you can use the below code for the same.

<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?>
        <?php foreach($_categories as $_category): ?>
                <a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
                    <?php echo $_category->getName() ?>
                <?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
                <?php $_subcategories = $_category->getChildrenCategories() ?>
                <?php if (count($_subcategories) > 0): ?>
                        <?php foreach($_subcategories as $_subcategory): ?>
                                <a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
                                    <?php echo $_subcategory->getName() ?>
                        <?php endforeach; ?>
                <?php endif; ?>
        <?php endforeach; ?>
<?php endif; ?>

Install Komodo Edit 8 in Ubuntu 14.04

This article gives you support on how to install Komodo Edit in Ubuntu 14.04. Komodo Edit offers support for all your major languages,including Python, PHP, Ruby, Perl, HTML, CSS ,JavaScript etc.

The installation is simple, you can done it with the following three commands from the terminal.(Press Ctrl+Alt+T to open the terminal)

sudo add-apt-repository ppa:mystic-mirage/komodo-edit

sudo apt-get update

sudo apt-get install komodo-edit

‘The directory is not writable by server’ error in Magento

If you are facing an error ‘The directory is not writable by server’ in magento please ensure the following :

First of all Check if the server has the write permission on var and media folders. This might solve the issue. If still the issue persists go through the following steps:

check whether the ‘media/catalog’, ‘media/wysiwyg’ and ‘media/images’ are there in the media folder. If it doesn’t exists create the folders, and give write permisission for those folders.

Hope this will resolve your issue.