WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. wpkoi
    Member
    Posted 1 year 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:

    <?php
    include 'wp-content/themes/popd/mobile-detect/Mobile_Detect.php';
    $detect = new Mobile_Detect();
    ?>
    
    <?php
    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.

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. wpkoi
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

    Hello

    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
    Member
    Posted 1 year ago #

    Do the detection client-side instead.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic