How to Use Conditional Widgets with WordPress and Why They’re Awesome
Have you ever wanted to display different widgets within your sidebar or footer based on which page or category is being viewed? For example, lets say you have a widget for a calendar and you only want this to appear on your “events” page. This is a situation that calls for conditional widgets.
One option would be to hack your theme to bits in order to give your site support for conditional widgets, but that would be tedious and would require quite a bit of work. I’m a huge fan of easy, time-saving solutions. That’s why I’d like to introduce you to the Conditional Widgets plugin.
More than likely you’ve worked with conditional sidebars before, which give you the ability to show a different sidebar based on which page is being displayed. Conditional widgets, on the other hand, offer you the ability to control the display at the individual widget level.
Here’s how the Conditional Widgets plugin works: It adds an expandable form at the bottom of each of your widget settings where you can control the display options. You can select whether or not the widget is displayed on the home page as well as other pages and categories. The best part is that it requires no knowledge of php or conditional tags.
Simply install and activate the plugin and the new widget settings will instantly appear. Assign different pages or categories for each in order to conditionally show or hide them. The settings even extend to subcategories for more specific control.
Why use conditional widgets?
- Conditional widgets are the best way to maximize the available real estate on the page. Truly there’s nothing that screams “WordPress blog site!” louder than a million widgets running down the side of the page. If you need more of a CMS style website, then conditional widgets will help you to make better use of the available space.
- Keep your sidebars relevant to the page the user is viewing, instead of settling for static sidebar content. Not every widget needs to appear 100% of the time. Some are more blog-oriented, such as archives or a post calendar. Others are only relevant to certain plugins you may be using, such as e-commerce, events or maps. Conditional widgets lets you target the widgets to the pages where they are useful and hide them from more general pages.
The Conditional Widgets plugin is available for free in the WordPress repository. Get your copy today and start cleaning up your sidebars and footers.Tags: