• Hi Donncha,

    I’ve been meaning to ask this since I first installed WP-SuperCache (the first beta). I have two special templates for mobile phone users. One is for the Apple iPhone called iWPhone (obviously for my blog) and the other one is for pda and mobile phone users called WordPress Mobile. Both plugins use browser sniffing to serve a special template. I just can’t get this to work with whatever caching plugin I use (and have used). Normal desktop users sometimes get the mobile optimized template (served from the cache), more often than not mobile users get the normal desktop template. WP-(Super)Cache kicks in way before these plugins are called and so I’m forced to turn these plugins off (and send the desktop version to mobile users, for which I’m getting alot of angry complaints).

    My question: could you please find out a way to differentiate between ‘desktop’ and ‘mobile’ users and send mobile users to the proper plugin/theme instead of serving the desktop cache??? I’ve been searching for this solution ever since, but nobody seems to be willing to solve this dilemma once and for all.

    I’ve read about the non-cache calls, but to be honest that’s way above my head Any solution would be much much appreciated!

    Kind regards,
    -Jean-Paul

    (as copied from http://ocaoimh.ie/2007/11/26/digg-users-will-love-this/)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The simplest way of doing it would be to check the user agent in your .htaccess and if it’s not a mobile one then perhaps serve the super cached file, or the other way around depending on your traffic.
    Likewise, you’d have to write a small super cache plugin that would only create super cached files for the type of visitor you want.

    I know next to nothing about mobile user agents and don’t have the time to look into it, sorry.

    MegaZone

    (@megazone)

    The WP Mobile plugin has a function to check for mobile user agents, this is the list:

    $small_browsers = array(
                    '2.0 MMP'
                    ,'240x320'
                    ,'AvantGo'
                    ,'BlackBerry'
                    ,'Blazer'
                    ,'Cellphone'
                    ,'Danger'
                    ,'DoCoMo'
                    ,'Elaine/3.0'
                    ,'EudoraWeb'
                    ,'hiptop'
                    ,'KYOCERA/WX310K'
                    ,'LG/U990'
                    ,'MIDP-2.0'
                    ,'MMEF20'
                    ,'MOT-V'
                    ,'NetFront'
                    ,'Newt'
                    ,'Nintendo Wii'
                    ,'Nitro' // Nintendo DS
                    ,'Nokia'
                    ,'Opera Mini'
                    ,'Palm'
                    ,'Playstation Portable'
                    ,'portalmmm'
                    ,'Proxinet'
                    ,'ProxiNet'
                    ,'SHARP-TQ-GX10'
                    ,'Small'
                    ,'SonyEricsson'
                    ,'Symbian OS'
                    ,'SymbianOS'
                    ,'TS21i-10'
                    ,'UP.Browser'
                    ,'UP.Link'
                    ,'Windows CE'
                    ,'WinWAP'
            );

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Adding this into the super cache conditions in .htaccess would work.

    RewriteCond %{HTTP_USER_AGENT} !^(Mobile1|Mobile2|etc|etc) [NC]

    Put the most common mobile user agents into that string and there you go.

    However, *ideally*, you would not want to use a different page for mobile users in the first place. With CSS, you can serve a different stylesheet to “handheld” users and they will see something different, even with the same page. Sadly, this does not work with the iPhone, because the iPhone is stupid like that, but it does work with most user agents. See my own blog for an example, it provides a different CSS for handheld devices.

    I found a solution for this. There is no need to modify WP-Supercache.

    Instead, you only have to add a few lines of code to your wp-config.php. This is described in this great article.

    This will allow you to run one single wp-installation on two (or even more) different domains or subdomains. Each domain will have its own theme. In the backend, there is one single database.

    I have now one single WordPress-Installation available via

    Without any modification, WP-supercache keeps a separate cache for each of the two domains.

    Woot!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Wp-Supercache and mobile templates’ is closed to new replies.