One of the important elements in every WordPress site is a widget. People use it everywhere, in their sidebar, widgetized footer section, after post and etc. Sometimes you might need to show a specific widget on a particular post, page or template. It is really easy to do this.
To conditionally show WordPress widgets in specific post or page, I recommend using Widget Logic plugin. Trust me, this is a very handy plugin. All you need is a basic knowledge of using WordPress Conditional Tags.
Using Widget Logic Plugin
1. Install and activate the Widget Logic plugin.
2. Go to your Widgets page – Appearance > Widgets
3. To any specific widget and click on the arrow on the top right corner. You’ll see a new text field named Widget Logic somewhere at the bottom.
4. Put your conditional tags in that text field. For this example, I’m using !is_home tag. is_home means the widget will be shown on homepage only. The ! sign means it will do the opposite. In simpler words, I tell this widget to not appear if it’s homepage and show on everywhere else.
There are lots of WordPress Conditional Tags and they are really easy to use. You just need to read them from the WordPress Codex.
If you’re looking for customizing the appearance of every single widget, previously I’ve written a tutorial on this. Check this out – Add Custom Classes For Specific Widgets in WordPress.
Leave a Reply