W3 Total Cache
Fragment caching and mobile detect (5 posts)

  1. wpkoi
    Posted 3 years ago #

    I'm trying to use http://mobiledetect.net/ with w3 total cache and fragment caching, but I can't seem to get the markup right. No matter how I put the mfunc and mclude codes aroung this, it doesn't seem to work.

    This is how I use the mobile detect part:

    include 'wp-content/themes/popd/mobile-detect/Mobile_Detect.php';
    $detect = new Mobile_Detect();
    if ($detect->isMobile() && !$detect->isTablet()) { ?>
    <!-- me mobile, me like lightweight baby -->
    <?php } else { ?>
    <!-- stuff only for desktops -->
    <?php } ?>

    How could I wrap this up so that it would work with w3 total cache? If I put it straight out there without any mfuncs of mcludes, this will get cached based on the first visitor and the following visitors doesn't get the right version.


  2. wpkoi
    Posted 3 years ago #

    Anyone who could help in this matter?

    What I'm basically trying to achieve is to be able to use page cache and still use server side mobile detection, to be able to not serve ads via javascript to some users.

  3. kokoschka
    Posted 3 years ago #

    Hi wpkoi, did you manage to solve this problem?
    I face the exact same problem and I haven't found a working solution yet.

  4. leaase
    Posted 3 years ago #


    I'm having the same problem, and I would love to use both w3 total cache and Mobile Detect. Please someone find a solution :)

  5. jtwg
    Posted 3 years ago #

    Do the detection client-side instead.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • W3 Total Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic