Widget Logic lets you control on which pages widgets appear using WP's conditional tags. It also adds a 'widget_content' filter.
My widgets, when I want them.
Who can ask for more?
Great plugin, just the one I was looking for!
I don't know anything about PHP but the documentation and links helped a lot! I'm now about to easily cut and paste a little code so only certain widgets will show on my pages but with this will show on my Blog and Posts etc...
is_page('Blog') || is_single() || is_category( $category ) || is_tag() || is_search() || is_404() || is_paged() || is_archive()
I've used Dynamic Widgets, Display Widgets and now I'm happy with Widget Logic. It's the only plugin that feels more baked in. Works more behind the scenes. With Display Widgets I had to check too many boxes every time I added a page.
Does just what it says it does.
You need to know a smidgen of php templating code to set up the conditions but there are useful examples under Other Notes for those that don't.
This plugin makes it so easy to have widgets where you want them and not where you don't want them, so that each type of page gets the widgets that are compatible with it. Thanks so much!
nice plugin. thanks
Besides tying widgets to specific pages, I have been using the random function to make widgets rotate at random. I don't see it under the "Other Notes" tab and I forget where I found the idea, so I'll repeat it here.
On the first widget you want to randomly rotate, put code like this:
global $my_random_widget; $my_random_widget=rand(1,4); return ($my_random_widget==1);
My example above assumes I will have a total of 4 widgets to rotate. If you have more or less, change "4" to your total.
Then on each subsequent widget, just put in:
and change "2" on the third one you do to "3", etc.
This plugin has opened plenty of new possibilities for me, including a more relevant sidebar in magazines, removing widgets for mobile (not just hiding them).
Love your plugin, used it for multiple years.
Would you be willing to create a plugin called Menu Logic that works just like the Widget Logic?.