Hi. I am Marian, the owner of WPCONCEPT. I am a freelancer web designer focused on web development and i am a big fan of wordpress. I am from Transylvania, Romania and please excuse my grammar mistakes. I do my best to improve my english skills.

  • Home
  • Hosting
  • Contact

create multiple sidebars in wordpress

by admin on 23 November 2009

When you develop a wordpress theme maybe you have to use two sidebars which to use them both at once or on different pages. I recently encountered with this problem and i thought that maybe there is someone else in the same situation.

Creating multiple sidebars in wordpress is a fairly easy process. We have to work just on functions.php file. Your default functions.php file should look like this:

<?php
if ( function_exists('register_sidebar') )
register_sidebar();
?>

To create two sidebars paste the following code on your functions.php file:

<?php
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'sidebar1',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
register_sidebar(array('name'=>'sidebar2',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
?>

As you can see i’ve created two sidebars called sidebar1 and sidebar2. To use these sidebars paste on your php files the following code:

Sidebar1 code goes like this:
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar('sidebar1') ) : ?>
<?php endif; ?>

Sidebar2 code goes like this:
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar('sidebar2') ) : ?>
<?php endif; ?>

Hope you enjoy this.

This entry was posted on Monday, November 23rd, 2009 at 4:07 pm and is filed under How to. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “create multiple sidebars in wordpress”

  1. by eJohnny on 20 March 2010 - Permalink

    this helped me a lot :)

Click here to cancel reply.

  • Be in touch

  • Domains for sell

    wpdesigner.net

    wpfreelancer.net

    If you are interested please contact me.

  • Categories

    • How to
    • Themes
    • Tips
    • Tutorials
  • Archives

    • May 2010
    • December 2009
    • November 2009
  • Blogroll

    • Freelance Folder
    • WPRecipes
    • WPShout
    • WPZoom
  • Tags

    after each post branding custom content custom fields custom page template favicon free free theme free wordpress theme logo multiple sidebars online portfolio theme premium wordpress themes rss feed seo optimization social networks theme themeforest Themes visitors wordpress wordpress cms wordpress custom fields wordpress plugins wordpress security wordpress seo optimization wordpress sidebars wordpress templates wordpress theme wordpress themes wordpress theme tutorials wpzoom

© 2010 WPCONCEPT + wordpress resources
powered by wordpress

www.wpconcept.com