2 Sidebars, one for posts and one for pages (6 posts)

  1. Electric Studio
    Posted 7 years ago #


    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.

  2. ...paul
    Posted 7 years ago #

    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.


  3. pastorcox
    Posted 7 years ago #

    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.

  4. pastorcox
    Posted 7 years ago #

    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.

  5. moshu
    Posted 7 years ago #

    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

  6. Electric Studio
    Posted 7 years ago #

    I have managed to sort this out, the result is on a temporary URL, http://www.es01.co.uk 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.

Topic Closed

This topic has been closed to new replies.

About this Topic