I have a Press category on my blog that I have built a ‘Press Sidebar’ for. It works great on the Press page but not on the individual post pages within the press category.
I am trying this code in sidebar.php but it’s not working:
if (in_category(Press)) {
dynamic_sidebar('Press Sidebar');
$default_sidebar = false;
}
It just keeps showing the default sidebar.
I am stumbling. If someone can help here I would be much appreciated. Thanks.
Followup here that code was working to display the press sidebar but the Sidebar Blog elements were still displaying above them….
Josue thanks so much for the response.
I’ve already considered that plugin as an option – a good option I’ve used on other projects.
Trying to keep this site as plugin free as possible. I’ve already got it working with the above code I just stripped all the widgets out of the ‘Sidebar Blog’ and if I need widgets in the regular Blog category I’ll just treat it the same way as above since luckily all the post are already in a Blog category. So create a custom dynamic category for in_category Blog and go that route.
I guess my situation is unique with all blog posts already in a blog category. So in that case we can mark this complete.
Thanks!
Great news, you are welcome :)