Different sidebar shown on different pages
-
Hello,
I am trying to get WordPress to display a sidebar on single posts, and a different sidebar everywhere else on the site. If one of the sidebars has no widgets, I want it to go to the default sidebar configuration.
Currently my sidebar.php file has:
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>
and I’m trying to make it into:
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
when on a single post.I’ve tried many things, but I can’t seem to get it to work right. So far my code looks something like:
<?php if (is_single()) { if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : } else (if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : } ?> <li><h2><?php _e('Categories'); ?></h2> <ul> <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=1'); ?> </ul> .... <?php endif; ?>
But this doesn’t seem to work! Any help will be appreciated.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Different sidebar shown on different pages’ is closed to new replies.