WordPress.org

Ready to get started?Download WordPress

Forums

Different sidebar content per page? (5 posts)

  1. auxcendres
    Member
    Posted 5 years ago #

    i'm trying to figure out how to have different content in the sidebar on each page. for example, i'm an artist so on the page that shows my work i'd like to have different categories in the sidebar. or on my about page i'd like to have resume, bio and artist's statement categories in the sidebar.

    is this possible and can anyone help me figure out how to do it? thanks!

  2. tugbucket
    Member
    Posted 5 years ago #

    Conditional_Tag

    Lest say you have these categories and these are their category numbers:

    resume (cat 1)
    bio (cat 2)
    artist's statement (cat 3)
    oils (cat 4)
    acryllics (cat 5)
    mixed media (cat 6)
    fun stuff (cat 7)
    exhibits (cat 8)

    In your side bar you can do something like so:

    <?php if ( is_page('about')) { ?>
       <ul>
       <?php wp_list_cats('exclude=4, 5, 6, 7, 8'); ?>
       </ul>
    <?php } elseif ( is_page('gallery')) { ?>
       <ul>
       <?php wp_list_cats('exclude=1, 2, 3, 7, 8'); ?>
       </ul>
    <?php } else {  ?>
       <ul>
       <?php wp_list_cats('exclude=1, 2, 3, 4, 5, 6'); ?>
       </ul>
    <?php }	 ?>

    there might be an easier way but this should work.

  3. theailona
    Member
    Posted 5 years ago #

    You can either include different sidebar.php files, like the one mentioned in Cutomizing Your Sidebar or follow this short tutorial namely Multiple Sidebar Content in WordPress. :)

  4. alanft
    Member
    Posted 5 years ago #

    another useful thing is my plugin

    http://wordpress.org/extend/plugins/widget-logic/

  5. Desislava
    Member
    Posted 4 years ago #

    @alanft - just tried it on my installation based on WordPress mu - worked like charm. Thanks a lot for your effort - you just brightened up my day :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags