Support » Plugin: WP Mobile Detector » W3 Total Cache & Mobile Detector

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author websitezcom

    (@websitezcom)

    So sorry about that, it was viewable by me because I was logged into the website but it was actually marked private.

    You should be able to view it now.

    The snippet still doesn’t show

    Plugin Author websitezcom

    (@websitezcom)

    Hm, it keeps reverting it to private. Not sure why.

    function group_verifier($group_compare_value) {
    if(function_exists(‘websitez_get_mobile_device’)){ //Check to see if the WP Mobile Detector is installed
    $mobile_device = websitez_get_mobile_device(); //Returns an array with mobile detection values
    if(is_array($mobile_device) && $mobile_device[‘type’] == “1” || is_array($mobile_device) && $mobile_device[‘type’] == “2”){
    return true;
    }
    } //End WP Mobile Detector hook

    return isset($_SERVER[‘HTTP_USER_AGENT’]) && preg_match(‘~’ . $group_compare_value . ‘~i’, $_SERVER[‘HTTP_USER_AGENT’]);
    }

    Andrew W

    (@andrew-whitacre)

    Hi websitezcom — any idea if this code should still be working with W3TC version 0.9.3? I’m not having any luck.

    My scenario is: I’m swapping logos inside header.php, one for desktop/tablet, the other for mobile.

    The mobile one is inside if(wpmd_is_phone()) { html code etc. }, while the desktop/table one is inside if(wpmd_is_notphone()) { html code etc. }.

    I’m replacing the original group verifier function in mobile.php with your code above, but the cache still seems to be winning. (I’m doing all the necessary W3TC and browser cache clearing in between tries.)

    Am I perhaps using the right code in the wrong way?

    Andrew W

    (@andrew-whitacre)

    Still curious about the answer but for now I’ve compromised and kept the same logo with a bit of @media‘ing going on to size and position it correctly for mobile.

    Check your W3 Total Cache settings:

    In WordPress admin, go to Performance-> Page Cache -> Advanced -> Never cache the following pages.

    Add mobile-detect\.php

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘W3 Total Cache & Mobile Detector’ is closed to new replies.