WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Widgets
[resolved] Dynamic rule based on user agent (3 posts)

  1. Daedalon
    Member
    Posted 1 year ago #

    The option to set widgets invisible for people with a certain user agent would be very handy.

    We have some widgets that don't work correctly on iPhones using the Safari browser and Nokia Lumia with Internet Explorer, but they work correctly on all other devices we have tested so far. The current rulesets allow to hide based on the browser, but they don't allow for a device-based hiding.

    I'd imagine the option would work well if users could add strings and decide whether that's a Display or Do Not Display rule, and then have an option below for All The Other User Agents: Display or Do Not Display. This way we could create rules for "iPhone" and "Lumia", and as they match strpos( $_SERVER['HTTP_USER_AGENT'], 'iPhone' ), the chosen rule of Do Not Display would be applied. For every other user agent we'd set Display.

    Could this setting be added?

    http://wordpress.org/extend/plugins/dynamic-widgets/

  2. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    I've received similar requests for mobile detection. The plan is to have some mobile detection available in the next release. But to be honest probably not such a fine granularity you would like to have.

  3. Daedalon
    Member
    Posted 1 year ago #

    Ok, that's a good step forward in any case. For the problematic plugin vs. certain mobile clients case we had I've implemented a workaround in the plugin code. Not update-safe and has to be maintained by editing the code, but gets the job done today.

    The user-agent rule would be excellent and cover many more possible use cases, so hope it gets implemented one fine day. A further improvement to it would be the ability to specify if a certain rule is to be evaluated as regexp instead of just a string to be passed to strpos. That covers all user agent related cases I could think of between these two posts.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.