Customize Your Sidebars with Widget Logic

by Guest on June 19, 2009

So you’ve installed your WordPress theme and made the necessary design changes to it, but you’re not happy that the same sidebar appears on every single page of the blog. You’re not quite sure how to edit the template’s source code and so far you’ve hit a roadblock while trying to research other methods on how to have custom sidebars.

Enter Widget Logic

Widget Logic allows you to determine what sidebar gets featured on what page simply through the use of an extra control field called “widget logic.” How does it accomplish this? Widget Logic lets you to use WP’s Conditional Tags essentially saying that if this statement is “true” then display everything in “this” particular sidebar.

For example, you’ll notice in the image below a section called Widget logic that has the PHP statement “is_page(‘social’). This particular widget logic states that “if the page is called “social” then display everything that’s coded here in this sidebar; otherwise don’t display a sidebar.


Like the average blogger, you probably don’t know any PHP am I right? Well you don’t have to with this plugin!

The developer has taken the extra time to provide you with some of the most commons uses of this “widget logic”. For example, in the image below the developer has provided you with 9 different PHP statements that you could use such as “is_home()” – meaning show this sidebar if this is the homepage.


You can also combine statements to make an even more of a complex statement. An example would be:

“is_page('home') || is_page('menus') || is_page('bbq-classes') || is_page(‘catering-menu') || is_page('food-trays') || is_page('catering') || is_page('bbq-meats')”

In this instance, the statement says that if any of these page names are true then display this particular sidebar. This would allow you to put the same sidebar on each of these pages which is usually helpful when you have a set of pages that are all related.

This is all fine and dandy, but I bet you’re wondering what custom sidebars look like on an actual blog. The image below is an example of a blog (designed with the Thesis theme) using Widget Logic. As you can see, they change the sidebars to showcase different catering plates on their blog.


When you take into account that it’s been downloaded over 15,000 times from WordPress, has an average rating of 4.5 stars and it’s a breeze to download and install, it’s a very useful plugin to have on your side. Especially, if you don’t know any PHP!

You also get the added benefit of the developer providing you with the most common statements that users typically use when using Widget Logic. What more could you want in a plugin? Download it today and see how happy you’ll be with this plugin and your custom sidebars.

Casey Yandle is the Creative Director for Creative Daylight, a corporate identity & internet marketing firm that specializes in search engine optimization, web design and custom wordpress mods.

{ 7 comments… read them below or add one }

kat August 30, 2009 at 5:01 pm

I originally came over because of a review about Thesis, but I’m glad I stayed and took Jason’s advice and gave you a read. I’ve been looking for something exactly like this, and now I can do it myself without spending hours in a support forum or paying someone to hard code. Thanks a million

Ben Cook August 30, 2009 at 6:43 pm

Kat, I’m glad you like the post. Widget Logic has been an incredibly useful plugin for me as well.

Lesli September 4, 2009 at 3:05 pm

I’m a bit confused. I downloaded and activated the plugin and I’m using Thesis, but I don’t see where to change the options. Do I go into “edit” and change the code? Please help. This looks wonderful! Thanks much.

Ben Cook September 4, 2009 at 4:33 pm

Leslie, once you activate the plugin you’ll need to go to your widgets tab and each widget will have a widget logic field where you enter the conditions for it to display.

Teena October 2, 2009 at 9:51 am

Love this! I was wanting to change whhich widgets show up where and YOU have taught me how! Now I just need to find the time – I am re-designing my page with a different theme.
Thank you Thank You!

John April 17, 2010 at 6:03 pm

Is there a code where you can just plugin the id number of the page instead of the pages name? I have two pages on my website with the same name but their parent pages are different.

Ben Cook April 21, 2010 at 11:00 am

@John, there is, and I believe the plugin offers a link to common examples of the logic to use. I don’t know it off the top of my head but will research it and get back to you.

Previous post:

Next post: