Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the WP Super Cache plugin and inside my theme I have code that executes differently if the site is viewed on a mobile device (iOS, Android) than a desktop browser. How do make WP Super Cache create a separate cache for each, most likely via the user agent?

Right now, I have use mod_rewrite to serve cache, which I believe WP Super Cache will cache the pages as html files to be served. Since the cache is saved from the desktop browser, the mobile browser is seeing that as well. I'd like WP Super Cache to generate two separate caches, one of mobile devices and another for desktop browser. Is this something WP Super Cache can handle or is there a better cache plugin I should be using to make this work?

Thanks!

share|improve this question

2 Answers 2

up vote 1 down vote accepted

There are several ways to handle mobile devices and doing it inside of single theme is builky and hard to maintain (as for me at least). More commonly this seems to be accomplished with separate templates or separate mobile-specific theme.

I don't know about WP Super Cache specifics because I hadn't used it extensively.

Plugin I currently use is W3 Total Cache. It allows you to create groups of user agents strings, for which visitors can be redirected to another theme or domain and (as I understand from description of settings) will have separate versions of cached pages.

share|improve this answer
    
Thanks Rarst! I actually just finished setting up W3 Total Cache and it seems to be working as I wanted it. –  jaysonp Jan 1 '11 at 11:29
    
jaysonp: can you share which settings you made? You can post this as an answer as well (and even accept it as your answer). Doing would benefit the whole community. Thanks! –  hakre Jan 1 '11 at 14:19

Thanks Rarst. Your advice helped. For those who still don't know how to do this, here is what you should do:

  1. Go to W3 Total Cache control panel
  2. Choose User Agent Groups
  3. Under "User Agents" text area, paste the names of mobile devices
  4. Select the theme or enter a subdomain you want to use on mobile devices Save all settings.

That's it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.