We’ve got some good options for displaying sidebars conditionally: either by coding them or using a плъгин. Но, I’ve had a few situations with clients where the widgets themselves should be conditional, instead of creating entire sidebars. What are the options?
I’ll walk you through six that I came across, and which one I landed on for this client. Remember that the most important thing for me here was to have it work intuitively for them, not me.
This one’s got a decent UI and seems to work as advertised. I think it’s simple enough to get the hang of quickly.
One part that caught me off guard is that it actually echoes text above a widget being used conditionally when
WP_DEBUG is turned on. I like the idea of what’s happening there, but it’s without any explanation.
When it didn’t go away after logging out, I had to do a code-dive just to figure out what was happening.
This is another with a decent UI, although I find it a bit less intuitive than Conditional Widgets.
Това каза, it’s also been updated recently, which is a big plus in choosing something like this for a client.
Here’s where we start to trade a bit of the usability for features and flexibility. This gives you plenty of options, but takes you to another screen to complete them. That might be just fine for some clients more familiar with WordPress, but I’d prefer that most are able to complete these options in the widget view.
The conditions can be set in the widget view, but the implementation is a bit confusing. You’ve got checkboxes for templates (single post, single page, и т.н.), but you need to use actual URLs if you want the condition to be a particular страница. Effectively, this means you still have to leave the widget view to get the input you need.
You get tons of options here that are only a click away, but I don’t think for a second this would make sense to a client. Instead of using the ‘pretty’ versions of terms, the logic selection’s options are all in slug_ID format (т.е.. about_3).
This seems like more of a ‘I set up your widgets, please don’t touch them’ tool than something a less-familiar user would want.
If you have a death wish, here’s one you can set up for your client to use: a field of PHP conditions that get directly evaluated.
очевидно, this is designed for much, much more familiar users. It is indeed flexible, well-written, and up-to-date.
It’s another good option if you’re going to set things up and leave them as opposed to teaching a client how to use it.
When I had to decide recently, I rolled with Display Widgets. The UI was intuitive enough, and I valued the recency of its updates over Conditional Widgets’ cleaner implementation.
How have you solved this problem in the past, in a way that’s sustainable for you and your clients?