WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am the programmer on my small dev team, along with the content editor and designer. My colleagues want to be able to add a different sidebar to each new page they make without having to monkey with PHP code.

Is there a plugin or some other way of allowing them to make a new widgets sidebar for new pages they create?

share|improve this question

Registering sidebar is just a function call, there is no reason it can't be run on top of some logic. Here is code I wrote (and use) in my current theme:

$pages = get_pages();

foreach ( $pages as $page ) {

    register_sidebar( array(
        'name' => "Page: {$page->post_title}",
        'id' => "sidebar-page-{$page->post_name}",
        'description' => "Widgetized area after content of \"{$page->post_title}\" page.",
        'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>'

Then in page template call sidebar, following same ID convention and you are set.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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