This morning, I received a tweet regarding the best conditional widget plugin. This question got me thinking; what is the best plugin? There are several major contenders, but I never really considered which is the right option. I’ll go so far as to admit that the only reason I have traditionally used the particular plugin I usually do is out of convenience: it’s simply the first one that pops up in the WordPress repo when one does a quick search. Given the number of viable options, this arbitrary selection hardly seems appropriate; one would hope (although experience indicates that this isn’t always the case) that multiple options mean at least some were written in response to a need for functionality that doesn’t necessarily exist in said alternatives.
So what are the available options? For the purposes of this review, I’m going to be examining what I would consider to be the five most commonly used plugins: Widget Logic, Display Widgets, Conditional Widgets, Widgets Controller, and Widget Ninja.
In this review, I’m going to examine each of the contenders with an eye towards several different things. Perhaps the single most crucial element being reviewed is code quality, but that’s hardly the only thing of interest. Flexibility and ease of use will factor into the final decision as well. Given the number of themes and plugins which add custom post types, support for custom post types is relatively essential. Beyond that, most of the people using such plugins are probably not developers, so how user-friendly the plugin will figure highly into the equation.
I’m sure other things will come into play as I dig into the contenders, but at the moment the qualifications above are all that come to mind. So, without further ado, let’s move on to the matter at hand!
Widget Logic (Free)
First up is Widget Logic. This particular plugin is remarkably powerful, allowing users to handle widgets based on virtually anything. Sadly, for this review, its greatest strength may also be its single greatest weakness. The way Widget Logic works is through the addition of a text field to all widgets allowing the site operator to enter raw PHP or the conditional tags built into WordPress itself. For someone familiar with WordPress, this allows unlimited flexibility, but it also introduces a fairly important issue for those less familiar with development. The lack of a true user interface makes it a fairly steep learning curve, and the handling of raw PHP could potentially cause unexpected issues if the wrong line of code is entered in the logic field. That said, the fact that anything goes does make support for custom post types a non-issue.
Concerning the codebase, Widget Logic is what you’d expect from a plugin designed for power users. While it isn’t the prettiest code I’ve ever seen, it does include plentiful comments for those brave enough to tinker with it, and the developer has been kind enough to add a few filters to allow extension of the plugin.
A quick code review shows only one potential issue: the inclusion of the PHP eval() function to allow raw execution as indicated earlier. In and of itself, this isn’t necessarily dangerous, but if you aren’t familiar with PHP, it’s probably best to leave it alone. Additionally, Widget Logic is translation ready (for what it’s worth given the limited textual output) and comes with everything you would need to produce a localized translation file if you work with non-English clients.
All in all, Widget Logic isn’t a bad option for more advanced users, but it’s not ideal for the faint-of-heart.
Display Widgets (Free)
Display Widgets is a fairly well balanced mix of flexibility and ease of use. Unlike Widget Logic, it does include a fairly simple user interface, negating the need for familiarity with PHP or WordPress conditionals. The interface, while basic, is also relatively powerful. It’s broken down into three distinct areas: user status, visibility, and location. The field I’m identifying as user status allows the user to select whether the defined rules apply to logged-in users, logged-out users, or everyone and visibility determines whether to show the widget on selected pages or hide it. The location field is fairly intuitive, allowing users to select from a list which is further broken down into pages, custom post types, custom post type archives, categories, taxonomies, and a ‘catch-all’ miscellaneous group. This setup allows users to define visibility on a fairly granular level, but it’s far from all-inclusive. The lack of a simple way to handle visibility on a per-post basis isn’t likely to be a big issue for the majority of users, but its omission does feel like an odd oversight. Additionally, in a content-driven site, the list of checkboxes could quickly become prohibitively long.
On the flip side, Display Widgets does have a reasonably clean codebase, with only minor issues. Like Widget Logic, the developer has paid significant attention to documenting his (or her) code, making reading it reasonably straightforward. Additionally, there are plentiful hooks to allow easy extension. The only real downside to the Display Widgets codebase is a handful of missing text domains which result in incomplete translations, for those who prefer to display their site in a language other than English.
While Display Widgets isn’t the most flexible option out there, it’s also not a horrible one. If you’re looking for flexibility or a pretty interface, this might not be the plugin to choose. If you’re looking for simplicity and don’t have too much content to wade through, it could be a good choice.
Conditional Widgets (Free)
Despite the lack of functionality, the codebase doesn’t look bad at a glance, but a more in-depth look reveals one major flaw. Surprisingly, Conditional Widgets is completely lacking in the internationalization department, making it effectively a no-go for non-English users.
Sadly, in this case, I believe the cons outweigh the pretty interface; so Conditional Widgets won’t be making an appearance on any of my sites soon. That said, if you have don’t need support for custom post types (or posts in general), the interface does lend itself to ease of use for beginners, so I really can’t say its a complete loss.
Widgets Controller (Free)
I almost decided to leave this particular plugin out, but at the last minute decided to review it in the sake of completeness. Unfortunately for Widgets Controller, the only thing it has going in its favor is support for individual posts, though its implementation is fairly abysmal. Widgets Controller is nice enough to keep its interface hidden until you check the ‘Widgets Controller’ checkbox, which is a particular blessing in this case. Once selected, Widgets Controller pops up a dialog which takes up a massive 50% of your screen real estate, even on a fresh install, and I can only imagine how cluttered it gets on a fully built site.
As if the ugly dialog wasn’t bad enough, the content contained therein involves so many checkboxes that its almost unmanageable, and a few short seconds was all I could stand to stare at it before closing it in disgust.
Like the rest of the plugin, the codebase is rough. It includes minimal commenting, no support for internationalization, and a glance at its support forums shows minimal developer support. Despite its 4.5-star rating, its lack of functionality and clumsy, un-intuitive interface make it a definite no-go for me.
Widget Ninja (Commercial/$10)
Last, but certainly not least, is the only commercial plugin in our list. While commercial doesn’t necessarily mean quality, in this case, Widget Ninja hit the jackpot. Of all the plugins I reviewed, Widget Ninja manages to be the only one that supports almost literally everything, while still featuring a remarkably clean interface. If you aren’t actively controlling the visibility of a specific widget, the control box stays neatly hidden. Even when displayed, it manages to provide flexibility while remaining simple enough for a user with a decent grasp of WordPress. It does display the available options in the form of the relevant WordPress functions, but for the most part they’re fairly self-explanatory, so this shouldn’t be a deal-breaker.
Internally, this plugin features the cleanest code of any I reviewed (which is no surprise given the standards Envato has set for inclusion in CodeCanyon), but it does have one major shortcoming. Sadly, despite its incredible interface, almost nothing in Widget Ninja is translatable. However, all of my sites are English-based, so Widget Ninja will likely be my plugin of choice for situations where I need to control widget visibility.
Once all the results are in, I can’t define a single plugin which I consider the ‘perfect’ fit for this use-case. I can, however, narrow it down to two excellent options. If you are working in English and don’t mind the price tag, Widget Ninja is the most intuitive choice. Unfortunately, the lack of support for other languages prevents me from saying this is the best option altogether. If you prefer a more minimal interface, Display Widgets would be my plugin of choice. Additionally, it’s the best option if you aren’t working in English.
So which option is right for you? Is there another plugin out there which provides similar functionality that you prefer? Or, better yet, tell me what you’d like me to post next! I’ve been trying to up the number of posts I make per month, but most of my topics come from comments on Twitter, so suggestions are always welcome!