• Is there a way of having the ‘mobile device support’ deal with multiple mobile devices?

    I serve up different theme for iPad to what I server up to iPhone (so 3 themes in all, desktop, ipad and iphone). I’ve added iPad to the list of mobile devices in the wp-cache.php file, which includes the iPad as a mobile device. However, wp-super-cache seems to group all mobile devices together – so both iPad and iPhone display the same cached files (what theme it gets depends on which device viewed the page first). Obviously not the intended result.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Yes, look in wp-cache.php for “ipod” and check out the filters on those arrays. You can have an “ipod” group so those devices get their own cache file.

    Don’t modify wp-cache.php directly, use the filters!

    Thread Starter nathanadams

    (@nathanadams)

    Sorry for my ignorance, but how do I use the filters?

    I tried to change line 450 from
    // mobile_groups = array( 'apple' => array( 'ipod', 'iphone' ), 'nokia' => array( 'nokia5800', 'symbianos' ) );
    to
    // mobile_groups = array( 'apple' => array( 'ipod', 'iphone' ), 'ipad' => array ( 'ipad ), 'nokia' => array( 'nokia5800', 'symbianos' ) );
    but no affect. iPad and iPhone are still accessing the same caches as eachother.

    Or am I looking in completely the wrong place?

    Thanks for your help.

    You’ve still got “ipod” in the “apple” group! ??

    You should use the “cached_mobile_groups” filter rather than changing wp-cache.php to make upgrading the plugin easier.

    Thread Starter nathanadams

    (@nathanadams)

    Ahhh, ok! It should have occurred to me that the ‘ipod’ would cover both iphone and ipad. I changed it in the wp-cache.php file, and it seems to be doing what I want now.

    If I want to use the cached_mobile_groups filter, rather than editing the wp-cache.php file as you say, where would I find that?

    Cheers!

    Looks like I spoke too soon. After waiting a bit and checking again later, now the iPad version and the main desktop version are getting mixed up with each other.

    My mistake, I thought you had ipod in both arrays, not ipod in one and ipad in the other.

    Using filters is complicated, best use Google and research it as it’s important to know if you’re modifying things!

    The only way to figure this out is by exhaustively debugging it unfortunately. Look for the mobile code in wp-cache-phase1.php and log what that returns, and you’ll probably have to debug wp-touch too to make sure that returns the right template the first time.

    I looked in the code in wp-cache-phase1.php – you need both useragents, ipad and iphone in the mobile browser list before the code checks the groups. The iPad isn’t there by default. Does that help?

    Unfortunately, as soon as you add iPad to the mobile browser list, it goes back to mixing up the iphone and ipad versions again.

    Maybe the issue is that I’m not using wp-touch for the alternative themes, but instead Mobile Theme Switcher (It’s the only one I’ve been able to find that lets you independently pick alternate themes for ipad and iphone). Obviously doesn’t want to play nice with WP Super Cache.

    I think fiddling around with filters might be a bit beyond my skill set at this stage. It’s certainly gone on my to-do list to learn though ??

    Cheers.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: WP Super Cache] Different cache files for different mobile devices?’ is closed to new replies.