Here’s a very hand little plugin for you, it’s called widget logic http://wordpress.org/extend/plugins/widget-logic/ and it lets you control where or when a particular sidebar widget is displayed by adding some conditional logic to the widget config.
WTF Give me Some Examples
It’s probably easier to use examples to explain what the plugin can do:
- You may only want an email sign up widget to appear on the home page
- You may only want your twitter link to display on a blog post not a page
- You may want your categories widgets to appear on your contact page (running out of examples already)
WordPress Conditional Logic
Sorry but this plugin requires a little understanding of WordPress conditional logic to work, but once you have mastered that you can control which widgets appear where. Full details of WordPress conditional logic can be seen using the following links
http://codex.wordpress.org/Conditional_Tags
Some Examples
Here are some examples of the logic in action
- is_home() – this will check for the home page
- is_page(‘contact’) – check for the page called contact
- is_sigle() – this will check for an individual blog post
Hello Operator
There are a number of operators available in WordPress so you can join logical statements to create more complex tests, here are some example operators.
- && – and
- || – or
- ! – not
So you could say I want to display a widget on the home page or the contact page, the statement would look like this
is_home() || is_page(‘contact’)
Installation & configuration
The plugin is install as any other plugin, once activated a new form field is added to the bottom of your sidebar widgets.
Compose a logical statement and add it to the widget logic form field and you will only see that widget when the conditions are met.
Wrap Up
Widget logic is an excellent plugin to help control where widgets are displayed, if you are using WordPress as a CMS, and not a blogging platform this is an excellent tool to add to your toolbox.
If you need help building your logical statement you know which link to follow hint this one https://wpdude.com/wordpress-technical-support
2 thoughts on “Plugin Review: Widget Logic”
Oh man, you’re a legend – you don’t know how many times I would’ve preferred using something like this rather than hacking around in PHP.
Thanks
Chris
Hi!
When I first discovered Widget Logic a few weeks ago because of a question by a user on the IRC WordPress channel, I went, “How’d he do that?!?!!”
I knew I had to make a blog post about it and mine is at:
http://www.n4express.com/blog/?p=185
It’s one of those things that I hope will make its way into the WordPress core.
BTW, you have a typo in your post. Under the “Some Examples” section, the function name should be “is_single()” and not “is_sigle()”.
Comments are closed.