Support » Fixing WordPress » 2 Sidebars, one for posts and one for pages

  • Hi

    I would like to have one sidebar for my posts and a different one for my pages. The sidebar for the POSTS should contain the categories, archives and tags. The sidebar for the PAGES should only contain the “Sub Pages widget” that show associated child sub-pages.

    What is the best way of doing this? I’m fairly new to WordPress.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Find a theme you like with two widget ready sidebars; and just add the widgets you want to display. There are a lot of themes to choose from that should enable that.

    With any theme, you’ll need to add in some conditional code in the sidebar. So in your sidebar.php file, you’ll need to add something like…

    <?php if ( is_page() ) { ?>

    Then here, whatever you’d like, including the necessary function for widgets that would only show up on a page. And then…


    You can indicate a particular page, or single posts, or many other things.

    Definitely check here too, for a full explanation of conditional code. You can insert conditional tags into your sidebar.php file and then what does between the conditional tags will only show up where you want it. This can be true for single posts, pages, etc.

    1. Check here = empty link.
    2. No matter what you put in your sidebar code – if and when using widgets, everything will disappear and only the widgets will be displayed.
    3. Which means what the OP wants is a bit more complicated than it was described above… but it is doable.

    Solution A)
    – you make two sidebar files and the second one will be called by your Page template(s) by
    <?php include (TEMPLATEPATH . "/theothersidebar.php"); ?>
    (change only the filename!!!)
    – make the required modifications in the theme’s functions.php to register the second sidebar; search it has been posted several times

    Solution B)
    – you use conditionals AND two “dynamic sidebar” portions in one single sidebar.php file
    – edit functions.php

    I have managed to sort this out, the result is on a temporary URL, and is working sweet.

    I figured out how to use a set of 4 different sidebars, then calling them by using 4 different templates. WordPress is pretty nifty huh?!

    Thank you for all your suggestions.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘2 Sidebars, one for posts and one for pages’ is closed to new replies.