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!
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
}
?>
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
}
?>
hedonplay
Member
Posted 2 years ago #