Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.