Some tricky PHP required and I cannot figure it out myself, what I need is basically a combo of these two posts:
Different sidebar for each category?
What I have now is a generated sidebar for each category which automatically shows custom widgets on each category view.
What I need is that same sidebar to show up on each post within that category and I cannot get it to work. Right now I load the dynamic sidebar like this:
<?php dynamic_sidebar( 'Sidebar '.$category_name ); ?>
but that does not show anything when you view a single post.
In the function.php I generate the dunamic sidebars by running a loop through all categories. In wordpress users can fill each sidebar with widgets just like they want.
How can I get that right sidebar to show up for posts in the right category? I tried using the in_category function but that does nothing, I think because it is loaded from the sidebar.php and that is not in any loop or something... Need help, thanks.