WordPress.org

Ready to get started?Download WordPress

Forums

Mobile Detector
ipad exclusion problem (10 posts)

  1. roohunt27
    Member
    Posted 1 year ago #

    Hi there,

    I love the plugin, been really helpful! One thing is that i'm trying to exclude the ipad so that it only uses the desktop theme on ipad (but switches to mobile on all other devices) - I've tried removing the ipad references from the 'mobile-detector.php' file but it still directs to the mobile theme when I visit through an ipad (even after clearing all cookies).

    Would really appreciate any help you can offer.

    Thanks in advance and kind regards,

    Andy

    http://wordpress.org/extend/plugins/mobile-detector/

  2. roohunt27
    Member
    Posted 1 year ago #

    Nobody got any idea how I can solve this? I really would prefer not to use another plugin as this is perfect except for this one thing... Please help!

  3. pixelkicks
    Member
    Posted 1 year ago #

    I would also like to know if this is possible. I'm considering using this plugin but want to make sure it can do everything I need.

  4. HandsomeWeb
    Member
    Posted 1 year ago #

    I am uninstalling this plugin because I need the iPad to show the full version of the site.

  5. Tubal
    Member
    Plugin Author

    Posted 1 year ago #

    I'm figuring out a way to give users the possibility to exclude certain mobile devices (iPad , other tablets, etc..) from being served the mobile theme.

    It'll take me some days to implement because I'm quite busy right now but, no fear, it'll be out in a few days.

  6. LukeRollans
    Member
    Posted 1 year ago #

    Tubal,

    I for one would be happy to pay for this plugin if it natively supported device exclusion.

    Until then, to anyone else interested, to exclude iPad from the plugin, change line 157 within the switch_theme function from...

    if ($options !== false && !empty($options['mobile_theme'])) {

    to

    if ($options !== false && !empty($options['mobile_theme']) && !self::is( 'ipad' )) {

    This leverages the native is() function and aborts the theme switch action if the current device is an iPad. You can replace 'iPad' with any of the other keys Tubal has made available for further conditioning if need be.

    Looking forward to an update with device exclusion!

    NOTE: To anyone editing the plugin, your update will be lost when the author releases a new version :)

  7. ikrstev
    Member
    Posted 1 year ago #

    Thanks mate, just what i needed. Dev should include native device exclusion, i dont think it's that complicated feature

  8. sunil.ch
    Member
    Posted 1 year ago #

    Thans LukeRollans

    Your post really helps me..

  9. bsammut
    Member
    Posted 1 year ago #

    I needed this functionality as well and tried this out. It works great!

    Thanks LukeRollans!

  10. ynhat
    Member
    Posted 1 year ago #

    You can use this class to detect tablet https://code.google.com/p/php-mobile-detect/

    include_once 'Mobile_Detect.php';
    
    $detect = new Mobile_Detect;
     if ($options !== false && !empty($options['mobile_theme']) && !$detect->isTablet()) {

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic