Forums

Sidebar for specific pages? (4 posts)

  1. Mandarke
    Member
    Posted 2 years ago #

    Hello, I'd like to allocate different sidebar widgets for separate pages within my site (where I'm using wordpress as a cms rather than blog) and on some pages remove the sidebar altogether. Could anyone advise me if this is possible and, if so, could you point me in the direction of how to achieve it? Many thanks in advance!

  2. hedonplay
    Member
    Posted 2 years ago #

    Yes we can do it with the help of conditional tag.

    For example you want to display sidebar "test" only in the category "test",do this:

    <?php
    if(is_category('test')){
    //sidebar test here
    }
    ?>

  3. Mandarke
    Member
    Posted 2 years ago #

    Thank you! Presumably this will work for pages as well as categories? i.e.

    <?php
    if(is_page('test')){
    //sidebar test here
    }
    ?>

  4. hedonplay
    Member
    Posted 2 years ago #

    Yes, you've got it!

Topic Closed

This topic has been closed to new replies.

About this Topic