Support » Fixing WordPress » Smart Multiple Sidebars

  • Hi all. I’ve been successfully running multiple widgetized sidebars on my site for some time ( Each section has its own sidebar but I think the way I’ve been doing it is a bit clunky. Each section has its own page template and sidebar file. Is there I can edit and only use sidebar.php to show the correct sidebar for a page and all its children? Essentially, I was to say “if page is X or parent is X show sidebar Y”

Viewing 2 replies - 1 through 2 (of 2 total)
  • Good news. I’ve figured out how to do this minus separate template files by adding this to my page.php. I would still love to be able to do away with the separate sidebar files altogether to further simplify so thoughts are welcome!

    if ( is_page('Me') || $post->post_parent == '2168') {
    } elseif (is_page('Content') || $post->post_parent == '2175')  {
    } elseif (is_page('Site') || $post->post_parent == '2172') {
    } elseif (is_page('Links') || $post->post_parent == '2965') {
    } else {

    I just thought I’d update this with a related find. This blog post has an even cleaner method of calling multiple sidebars:

    I no longer have multiple sidebar files in my theme directory but I am still interested in a smarter/neater way of doing this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Smart Multiple Sidebars’ is closed to new replies.