WordPress.org

Support

Support » Plugins and Hacks » Different custom sidebars for various Pages?

Different custom sidebars for various Pages?

  • 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…

Viewing 1 replies (of 1 total)
  • Moderator Mark Ratledge

    @songdogtech

    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 } ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Different custom sidebars for various Pages?’ is closed to new replies.