WordPress.org

Support

Support » Plugins and Hacks » [Resolved] W3 Total Cache and WordPress Mobile Pack?

[Resolved] W3 Total Cache and WordPress Mobile Pack?

  • Hi Frederick and others,

    Since W3 Total Cache and MobilePress are reported to be incompatible, and Wapple Architect is just too difficult for my limited synaptic firing abilities, I am trying to get WordPress Mobile Pack working with W3TC. The results are confusing…

    I am using http://ready.mobi and http://www.opera.com/mini/demo/ to see the results:

    1. Mobile Pack off, W3TC on – web theme, large images (as expected)
    2. Mobile Pack on (default config), W3TC off – mobile theme, small images (fast, good visual result)
    3. Mobile Pack on, W3TC on (all Mobile User Agents copied to the Rejected User Agents field)- web theme (?), small images (fast but weird visual result)

    EDIT: When both on, there seems to be some kind of combination of mobile and web theme being served: Partly adapted to small screen width and no theme background images but still (so it seems) the basic web theme layout. Looks like the mobile stylesheet is used in combination with the web theme source…

    Is there anyone with experience with these two plugins running together?

    Thanks for any tips 🙂

Viewing 15 replies - 1 through 15 (of 31 total)
  • Frederick Townes

    @fredericktownes

    Make sure to use the same rejected user agents list in the minify settings tab if enabled.

    Make sure to use the same rejected user agents list in the minify settings tab if enabled.

    Thanks Frederick, that solved it! 🙂

    You’re welcome.

    I’m glad it’s solved… I will update the docs accordingly.

    (I am also working on a pro-active solution for SuperCache, and I’ll try and make sure this works in the general case too)

    Thanks, all
    James

    Ok.

    @ jamesgpearce

    did you succeed in making mobile pack compatible with super cache yet? if so, in which cache mode (half-on or on) can the two be used together ?

    thanks!

    EDIT:
    Oh, as I read mobile pack needs to be in /plugins/ when running on WPMU: can mobile pack be activated site-wide or is it better to do it per blog ?

    I’m also anxious to see mobile pack work with wp super cache. This would be a killer combination.

    Darelparker, I’m not aware of the solution for WP Super Cache, I added that tag to this topic.

    fredericktownes – thanks, wp-super-cache supports wp-mobile-edition out of the box but not other mobile plugins.

    I’m thinking of adding a filter on the list of mobile user agents so mobile plugins can modify the list to suit the mobile devices the plugin supports. I haven’t got around to that yet but it’s a simple mod. Then it’ll be up to mobile plugin authors to support wp-super-cache.

    I’d like to work with Frederick so w3-total-cache uses the same filter. Make it easier for mobile plugin authors to support our plugins!

    I have just finished and committed to SVN an implementation of the new actions of WP Super Cache that make the mobile pack work nicely with it. Unfortunately it’s still “just” the partial cache as Super Cache does not let me control how the local files are stored.

    See here the changes if interested: http://plugins.trac.wordpress.org/changeset/234095

    Next thing is make the Mobile Pack work with W3 Total Cache.

    For both WP Super Cache and W3 Total Cache, I think you can safely move to our detection approach as implemented in lite_detection.php as it is more up-to-date than Alex King’s and we want to keep it updated.

    AndreaTrasatti – looks good but I think you’d have to make supercache use the “late init” feature where the cache is served and initialised on “init”.

    I’m going to add a filter on the mobile user agents list today and I’ll update this thread when I do. Users will only have to visit the Supercache admin page to be alerted about new mod_rewrite rules. I’ve held back on allowing the plugin auto update those rules because of the risk of overwriting local mods but I bet 99% of users use the stock rules.

    Just added a filter, “cached_mobile_browsers” so you can filter the list of mobile user agents. Unfortunately the user has to visit the Super Cache admin page for that filter to fire.

    I also added the function “update_cached_mobile_ua_list()” to do the same thing but it won’t update the mod_rewrite rules (yet). You can call that from within your own plugin, of course after checking that it exists first!

    When W3-Total-Cache supports mobile users if it uses that filter and function too it should make it easier for mobile plugin authors!

    Hi Donncha,
    these are very good changes, thank you. I will look into the code as soon as possible and start playing with them. When are you planning the next official release that will include these?

    Speaking of the function “update_cached_mobile_ua_list()”, if you look at our lite_detection.php you will notice that we use a few methods to detect if a visitor is a mobile browser. Your approach, which is very valid and will catch most browsers, is still not as complete. I wonder if we can bring any consolidation here and make sure all plugins that want to do mobile can use the same code-base.

    I started a separate thread for W3 Total Cache and mobile integration and I will recommend some changes. Bringing the two caching plugins in line would make it easier for developers, of course.

    WRT “late init”, I see a mention in your changelog, I’ll have to look at it. My idea would be to make the cache store the mobile pages in a separate direcory (say hostname/mobile/path/pagename/index.html) and then add new rewrite rules to pick up the appropriate path. Of course as you say, changing those rewrite rules can be dangerous although 99% of users will likely use the stock rules. On the other hand, if you now allow plugins to modify the list of user-agents for mobile, then the rewrite rules should be modified accordingly.

    EDIT: Fixed a couple of typos

    Thanks Andrea, that lite_detection function looks comprehensive! I’ll update my mobile detection script to follow those guidelines.

    Currently Supercache bypasses the supercached pages if it find a mobile user agent and uses the PHP powered caching instead as you’ve probably guessed. For 99% of sites this will be perfectly fine as there’s hardly any difference in speed between both modes.

    I’m planning a new release soon, probably this week, especially as the preloading stuff is working well on my server.

    Andrea – is it worth having a separate cache key for each mobile useragent? That’s what I do now so that an iPhone visitor gets shown a different cache file to a Nokia visitor.

    I’m going to add support and a filter on your UA prefix list too.

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘[Resolved] W3 Total Cache and WordPress Mobile Pack?’ is closed to new replies.
Skip to toolbar