Filing Cabinet - woman putting back an importa...

You are familiar with the wordpress Widgets section. You can drag and drop things to your sidebar: recent posts, latest posts. It is a good wordpress feature.

What about if you want to edit stuff on other locations of your website directly from the admin panel ? For example a portion of your header or footer, or you just simply want to add another sidebar.

It is simple, in the template file you want to add a section where you will drag and drop widgets, use the following code:

<?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘sidebar1’) ) : ?>
<?php endif; ?>

You’re not done yet. Now you have to register the sidebar.  We called the sidebar “sidebar1”.

Open functions.php file and then paste the following code:

if ( function_exists(‘register_sidebar’) )
register_sidebar(array(
‘name’=>’sidebar1’,
‘before_widget’ => ‘<li id=”%1$s” class=”sidebaritem”>’,
‘after_widget’ => ‘</li>’,
‘before_title’ => ‘<h2 class=”widgettitle”>’,
‘after_title’ => ‘</h2>’,
));

Now you’re done. It is still called sidebar, but you can use it on your header, footer or homepage.