I am wondering what the standard procedure for Sidebars in WordPress. My theme needs to have 3 different types of sidebars, to be used on three different pages. I am wondering if I should create a seperate sidebar for each of these pages or use logic, to determine which form it will take? As stated earlier each sidebar will have different uses for each page template it is on.

  • 1
    Depends on how you want/need the sidebar(s) to behave. I don't see this as answerable by anyone but you. – s_ha_dum Nov 28 '13 at 4:23

Create separate sidebars for each page unless all of them are supposed to display the same set of widgets.

I guess you will be managing your sidebar widgets through Appearance Widgets Screen (which displays all registered widgets) so just use register_sidebar() three times or preferably register_sidebars() (set number to 3) within your functions.php file and then you're ready to put these in your template files:

<?php dynamic_sidebar( 'id-of-your-first-sidebar' ); ?>
<?php dynamic_sidebar( 'id-of-your-second-sidebar' ); ?>
<?php dynamic_sidebar( 'id-of-your-third-sidebar' ); ?>

Hope it helps. I might be wrong but I don't really see a point in creating one sidebar and using logical operators to modify them.

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.