What's the proper way to call a second sidebar in the main home of my blog? And I mean 2 sidebars at the same time....

I might edit the question when I get further info, but now I'm feeling completely lost.

  • A second sidebar is a bit fague. Position makes a big diffirence here. Where do you need to place this second sidebar. – Pieter Goosen May 20 '14 at 5:15

All that get_sidebar() really does is load a file. Which file you load depends on how you call the function. get_sidebar() will load sidebar.php from the theme directory. get_sidebar('two'); will load sidebar-two.php from the theme directory. "Theme directory" means the same folder as should have style.css. That is all there is to using the function.

Beyond that, I don't know what this question means.

| improve this answer | |

As @s_ha_dum has said in his answer, you need to create a second sidebar and call it. To expand on his answer:

1) Register the sidebar. Put the following in functions.php:

if ( function_exists('register_sidebar') ) {
'name' => 'Second Homepage Sidebar',
'id' => 'second-homepage-sidebar',
'description' => 'Secondary sidebar for the homepage',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',

2) Duplicate sidebar.php and rename the file sidebar-two.php.

3) Change the sidebar id referenced in sidebar-two.php, e.g.

<?php if ( is_active_sidebar( 'sidebar' ) ) : ?>

<?php dynamic_sidebar( 'sidebar' ); ?>


<?php if ( is_active_sidebar( 'second-homepage-sidebar' ) ) : ?>

<?php dynamic_sidebar( 'second-homepage-sidebar' ); ?>

3) In either home.php or front-page.php (depending on how your website is set up), you need to call both sidebars:

<?php get_sidebar(); ?>

<?php get_sidebar('two'); ?>

4) Start adding widgets to your sidebar in the WP admin.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.