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

December 11, 2013 · 8 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!


{ 8 comments… read them below or add one }

Susan Velez December 11, 2013 at 6:47 am

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.

Reply

The Food Curator December 15, 2013 at 3:51 am

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 :)
The Food Curator invites you to read…What’s on your Christmas food list?My Profile

Reply

Julieanne van Zyl December 17, 2013 at 5:44 am

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.
Julieanne van Zyl invites you to read…Feeling good really helps to grow your businessMy Profile

Reply

silviu December 19, 2013 at 6:20 am

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
silviu invites you to read…When A Wonderful Woman Tells Her Story: Graphic Designer Angela MccallMy Profile

Reply

marquita herald December 20, 2013 at 7:05 am

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. :-)
marquita herald invites you to read…What it Means to Live an Empowered LifeMy Profile

Reply

Jesper D December 20, 2013 at 4:35 pm

Hi Kim.

Super post!

Would you consider this plugin better than the “custom sidebars” plugin?

Best regards

Jesper

Reply

Kim Castleberry December 20, 2013 at 4:46 pm

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

Reply

William Amis January 17, 2014 at 11:14 am

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.

Reply

Leave a Comment

CommentLuv badge