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: