Different custom sidebars for various Pages? (2 posts)

  1. aster
    Posted 6 years ago #

    I'm putting together a site navigated with a lot of single Pages. What I'd like to do is associate one custom sidebar to five particular pages, another custom sidebar to five other ones, yet another to a different group, etc.

    So far I've been able to activate new sidebars in my widgets, but only know how to associate one across the board for Pages. Is there a way to associate them with different, unique Pages?

    Any advice would be much appreciated...

  2. Mark Ratledge
    Forum Moderator
    Posted 6 years ago #

    Rather than have a bunch of sidebar.php files, you can do this in one sidebar.php and call it the same way in all page templates:

    <?php if (is_page(array('1','2','3','4','5'))) { ?> html for pages 1-5

    <?php } elseif (is_page(array('6','7','8','9','10'))) { ?> html for pages 6-10

    <?php } else (is_page(array('11','12','13','14','15'))) { ?> html for pages 11-15

    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic