Forums
Home / Fixing WordPress / get_sidebar by checking for the the category …
(@rasmuscarlsen)
13 years, 11 months ago
Hi all,
Sorry for my poor php. Here it comes;
I like to use a different sidebar for a specific category (and maybe antoher sidebar for another category).
As I understand its something lige this:
<?php if ( in_category('category-a') ) { <?php get_sidebar('category-a'); ?>; } elseif ( in_category('all-other-categorys') ) { <?php get_sidebar('sidebar'); ?>; } else { } ?>
But its not the way to do it …
Guess its basic php – I gotter learn some day 😉
thanks
rasmus
got it …
its as simple as this:
<?php if ( in_category('39') ) : get_sidebar('two'); //this will include sidebar-two.php else : get_sidebar(); endif; ?>
Sorry for sleepy eyes. ;-(