Reputation: 5403
I'm working on a Wordpress site that uses the Reason theme from Themeforest. I have been able to work out all issues except for two, one of which is the basis for this question.
The theme comes with a sidebar, but I want to disable it unless the user is on one of two category pages OR on a post in one of those two categories.
Here is the code from page.php that calls the sidebar:
<div class="four columns sidebar">
<?php dynamic_sidebar( 'default-widget-area' ); ?>
</div>
Any help would be much appreciated...
Thanks!
Cynthia
Upvotes: 0
Views: 1294
Reputation: 11
Checkout WooSidebars - http://wordpress.org/plugins/woosidebars/
This is a great plugin that has all kinds of logic that should fit your use case. You can create multiple widget areas in sidebars a on pages, page templates, and so on.
Upvotes: 0
Reputation: 14381
You have some functions that can help you with that:
From WordPres Codex,
in_category( array( 1,2,3 ) )
Returns true if the current post is in either category 1, 2, or 3.
Upvotes: 1