Show Different WP Widgets On Different Posts or Pages – Widget Logic

December 11, 2013 · 9 comments

in WordPress

Show Different WP Widgets On Different Posts or Pages – Widget Logic

wordpress logoWidget Logic Creates 
Dynamic Widgets

Wouldn’t it be spiffy if you didn’t have to show all the same widgets to every single user? 

What if you could hide membership related widgets from people not logged in? Or show subscription related widgets from people that were on pages they get to after subscribing? What about promoting an XYZ product in a widget only on posts in XYZ category? 

Turns out you can!

Introducing: Widget Logic
& Dynamic Widgets

Conditional display for WordPress widgets!

Widget Logic adds a small text field to the bottom of every widget box to enable you to declare the conditional or functional expression to control when/if a widget displays on a certain page.

Widget Logic is proven, tested, stable and pretty much “industry standard”.  

The only downside of Widget Logic is that you have to fill in a code snippet that… well… looks like code.  But the possibilities for precise control are endless!

If however, you don’t mind having less specific control, but want to skip this code snippet idea, the plugin Dynamic Widgets is an offspring of that plugin that adds some of the options as simplified check-boxes.

Today I’m going to cover Widget Logic. However, Dynamic Widgets is VERY similar and if you want to take a closer look at it, see Julieanne’s post here.  

Widget Logic

This free plugin has few settings of its own:

widget-logic-2

widget-logic-1Primarily though, it adds a visibility field to the bottom of every single widget item in your sidebar (from the admin view). 

Leave the visibility field blank to show all…. or fill it in with a conditional PHP or WordPress code statement, to get the desired effects. 

Some examples include 

is_user_logged_in()

is_home()

is_page()

!  is_user_logged_in()

! is_home()

You can find more WordPress conditional tags – and Functional tags –  here in the codex. 

For example, you may only want a certain widget item to display on a certain blog post… you can do that with this!

You can download Widget Logic here or Dynamic Widgets here.  

Simple, lightweight, effective… the perfect solution for this project and maybe for one of your projects too!

~ Kim ~
Simple Tech Tips For Marketing

PS: You can also use conditional expressions on menus and run different themes on different post/pages.  

Get The Inside Scoop!
social tripletKeep up with all the latest social marketing changes!


9 comments
Cindy
Cindy

This is a good article to see the differences between the two plugins.. I have now tried them both on a new site to see if they fit, but when I installed them, the site got very slow? I would not call that lightweight, and my site is not even that big yet, so unfortunately this is a no-go for me :( I am used to the plugin Content Aware Sidebars, but it has so many features that it become confusing.. Luckily it does not slow down my sites at all.

I am always looking for ways to improve my site with new plugins, but these plugins do just not perform very well:(:(

William Amis
William Amis

Kim,

The easy usages are amazing and even anyone who has no experience in code can use it. The copy & paste method is good and simple.

Most fear when it comes to navigation with code yet you made it simple by finding this needed supportive tool.

Thanks once again for useful information I appreciate.

Jesper D
Jesper D

Hi Kim.

Super post!

Would you consider this plugin better than the "custom sidebars" plugin?

Best regards

Jesper

marquita herald
marquita herald

Okay so the very word "code" just makes my eyes glaze over, but I love, LOVE the idea of being able to get more creative with widgets so I'm definitely going to take a close look at this. I also think I'm going to finally break down and take that basic code writing class at our local college because I'm sick of being intimidated by this stuff. :-)

silviu
silviu

Hi Kim,

Thank you very much for this post. I am interested in having more control of the widgets.

Writing a piece of code is not scary and I will check the Wordpress conditional tags. Everything depends on how easy the syntax is. However, I will certainly take a look at the other widget to see if it really simplifies the work.

Another great idea and another piece of valuable and useful information. Thank you.

Have a wonderful day

Julieanne van Zyl
Julieanne van Zyl

Hi Kim, just thinking about the difference between widget logic and "dynamic widgets". I had a quick look at the logic conditions you can use, and with "widget logic", you can specify different "single posts" where you want/don't want a widget to be displayed. That's something "dynamic widgets" doesn't allow you to do. I understand the "code" can put some people off though.

The Food Curator
The Food Curator

Kim this is awesome! It just goes to show how flexible WP can be, I love the fact you show different widgets on different posts. I will be checking this out :)

Susan Velez
Susan Velez

Hi Kim,

This is really cool, I really had no idea that you could show different widgets on different posts with this plugin.

On Woo themes which is the theme that I am using it allows you to create different sidebars that you want to show on different posts and pages.

It takes some time to implement the different sidebars. Using the WP Widget Logic plugin seems quicker. I will definitely have to give it a try...thanks for sharing, have a great day.

Kim Castleberry
Kim Castleberry

Jesper, this has a lot more granular control. I don't have to build a different sidebar for each category, I just tell the widget if it may or may not display there. On some sites, defining sidebars is a great approach because they don't really need a lot of detailed control. But often we want to fiddle with just one or two widgets and widget logic is a substantially better choice. I use widget logic on client sites if that answers your question better.

Kim