Widget Logic plugin for WordPress

Here is a screenshot of my latest WordPress plugin that adds a bit of contextual logic to any of the existing widgets.

It is still in beta, so please leave a comment if you would like to test it out.

Update: This is now available as Widget Context plugin at the official plugin repository (you can install it through your WordPress backend).

33 Comments

Ian Stewart 1 year, 7 months ago

I love this. For sure I’ll test it out. I already use a Widget Logic plugin—but this one is how it should be done. I’d even go so far as saying this should be in core.

Have you been using Drupal? This is very similar to how they handle “blocks”.

Kel 1 year, 7 months ago

Oh yeah…. sign me up please. I second Ian’s comment about this being in the core. Widgets seem underpowered for all the press they’d received.

Gareth Price 1 year, 7 months ago

Great idea, will get rid of the need for the half dozen registered sidebars or loads of php normally required to control where widgets display – would love to beta test – drop me a line. Thanks!

Kaspars 1 year, 7 months ago

Ian, yes — the idea is taken from Drupal as I have been using it for many years before WordPress and this widget/block logic feature is the one I missed the most in WordPress.

Kaspars 1 year, 7 months ago

Kel, you are on the list. I’ll send it tomorrow.

Kaspars 1 year, 7 months ago

Gareth, you are absolutely true — on this blog I am currently running only one widgetized area per sidebar. One might find it very useful for multilingual sites where you can target block placement by the language code included in the URL.

I’ll send the plugin to all of you tomorrow.

Mike 1 year, 7 months ago

This is probably the most useful plugin I’ve seen in a long time. I love how it can target a specific page to show a widget. I would be more than happy to test out this plugin, Sign Me Up!

Hafiz Rahman 1 year, 7 months ago

Woah, yes, this would make a useful feature within WP core.

Okay now somebody put this on WordPress Ideas :)

Zedalis 1 year, 7 months ago

GREAT!! Pleas sign me up!

Krystof 1 year, 7 months ago

I love to beta test this very promising work.
Pleas sign me up!

Alan Trewartha 1 year, 7 months ago

(Just checking back – i think my earlier comment got akismet zapped!)

Hope this isn’t cheeky to post this here, but… I’ve got a Widget Logic plugin up at wordpress.org/extend already – won’t post the link in case that’s what zapped me – but it’s URL slug is widget-logic.

Mine still works with the basic ’supply your own PHP’ way of doing things it started out with, but i’d always had an eye on putting in a simple tickbox ‘frontend’ like yours!

I *really* like your URL grep idea!

Allan 1 year, 7 months ago

I’de love to test this plugin out. It definitely has core potential as Ian stated above.

marc 1 year, 7 months ago

Be glad to test it on my home box as I’m about to change design of all three of my blogs and this would be a great addition.

SE7EN 1 year, 7 months ago

This is exactly what I am looking for. Please sign me up.

Kaspars 1 year, 7 months ago

Alan, thank you for stepping by.

This is really crazy — a few weeks ago I googled around for plugin with this functionality but could’t find anything. I must have used the “context” keyword too much or something, I don’t know.

Now I had a look at your plugin and I must say that you would have saved me many hours and even days which I spent trying to figure out the way WordPress updates widgets and how to take over widget controls.

So I’ll look at the best ways to improve my code or simply append yours with the URL grep part and checkboxes. Please let me know (a quick email would probably be the best) if you would like to cooperate.

Alan Trewartha 1 year, 6 months ago

:-) and some :-( at the same time? glad to collaborate any way you see fit. i’ve been thinking of a foolproof GUI way to flip between the 2 ‘modes’ (frontend tickbox v raw PHP).

i’ve not ever tried using an URL grep using the ‘free PHP’ method, but something like

preg_match(‘@category/peace/.*@’, $_SERVER['REQUEST_URI'])

should do the trick. not the most obvious syntax to the WP beginner!

the way i see it in my head (without thinking about it too hard) is as the tickboxes/grep field being a friendly frontend to mechanically create the ‘raw PHP’ text. some sort of gui toggle gives access to the raw text for advanced tinkering.

the most common logic text i use are things like is_home(), or is_category() || is_single() — which would work with the tickboxes as you have it now, but i’ve also got widgets that appear on specific categories, pages and tags. the most complex code i use is

global $post; return (is_single() && InSeries::adv_CurrentSeries($post->ID));

because the inSeries widget (which is no longer supported) doesn’t have a ‘only show when actually in a series’ option. (i suggested this to the author but he couldn’t see the point, and even disputed the legitimacy of hiding widgets when not needed!)

marc 1 year, 6 months ago

It’s been a week since I requested inclusion in the Beta testing of this plug-in, can I assume that’s not going to happen?

Kel 1 year, 6 months ago

Looks like Kaspars and Allan might collaborate on this – any updates? Also, I didn’t see any mention of this functionality going into WP 2.7 so I’d love to put Kaspars work into action.

Alan 1 year, 6 months ago

marc – you could try my publicly available plugin with the same (less friendly!) functionality. it’s at wordpress.org/extend/plugins/widget-logic/

schikowski 1 year, 6 months ago

Hello Kaspars,
I really like the way you do plugins.
I’d like to try this one out as well…

Thanks a lot,
schikowski

Dustin Fadler 1 year, 5 months ago

Any progress on this plugin? I’m very interested in using it.

JB 1 year, 5 months ago

Give it

Andrea Kalli 1 year, 2 months ago

OMG, you’ve just read my mind! I recently found the Widget Login plugin and was getting ready to ask you if there was a way to “display on all pages except” type of thing. I can’t wait to get my hands on the new version.

When will it be out?

I have a sandbox wordpress site and would love to help test this out, if you still need beta testers.

Andrea

Aonghas 1 year, 1 month ago

Hi there,

I would love to test your widget plugin out. It seems so practical!

Thanks heaps,
Aonghas

Kaspars 1 year, 1 month ago

Aonghas, the download link for Widget Context is available in this post.

Aonghas 1 year, 1 month ago

Cheers for that, it’s aweeeesome!

Stephen 1 year ago

I definately want to try this out too. How can I get a copy. I’m surprised this isnt already built into WP.

Casey MOrford 11 months, 1 week ago

Can I get a copy to test out? I have a site for which I’m looking for this exact feature.

Kaspars 11 months, 1 week ago

Casey, you can get the plugin under the Projects & Services link above.

Olivier 8 months, 1 week ago

Thank you for delivering such a helpful widget.
It Fits my needs and is much easier to use than widget logic.

tiffany 2 months ago

I’d love to try this out!

Tom Watson 3 weeks, 1 day ago

Oh I LIKE this. Would love to try it out (whenever it’s stable).

Kaspars 3 weeks, 1 day ago

Tom, this is now available as Widget Context plugin at the official repository (search for it at your WordPress backend).

Comments closed. Leave me a message »

Es vienmēr tevi mīlēšu, Sirsniņ!