Widget Logic – A Quick Guide
8 Nov 2012
Widget Logic is a great way to selectively choose which widgets appear on which pages. Very helpful for non-profits with sponsors whose contract is limited to certain services.
Here’s a screenshot of Widget Logic being used to limit a sponsor logo and text to a particular page:
Here’s an overview from Widget Logic’s plugin page of some common phrases. (Full List Here)
- is_home() — just the main blog page
- !is_page( ‘about’ ) — everywhere EXCEPT this specific WP ‘page’
- !is_user_logged_in() — shown when a user is not logged in
- is_category( array(5,9,10,11) ) — category page of one of the given category IDs
- is_single() && in_category( ‘baked-goods’ ) — single post that’s in the category with this slug
There are endless possibilities with what you can do with theses. Widget Logic fully supports WordPress’ conditional tags.
- Make sure you include a space between the parentheses and the single quotation mark.
- If using a categorical condition (to display a widget just on a certain blog category) you may need to to install the Reveal ID’s Free Plugin so you can see the Category ID numbers on the admin page.
- Keep it simple … if you find yourself adding dozen of widgets to customize your site, it is probably a sign that you may need a better WordPress theme that supports custom layouts and/or static content blocks such as Salutation
If you have any questions on this, scroll down and leave a comment or shoot me an email.