My first rant, though certainly not my first try
A couple of months ago, I wrote about the trials and tribulations I had encountered and failed to overcome in regards to making WordPress a little more mobile-friendly. I’m not a coder or even a web developer/designer (though I sometimes pretend to be at work), so beyond using the tools and guides provided and tweaking some code, I’m at a loss for how to redo everything and make it work myself. Unfortunately, the tools that existed didn’t play well together and therefore didn’t serve my purposes for providing a fast site that also worked on mobile browsers.
When I wrote about my failed attempts, I learned that the coder, patrias familias, and maintainer of WP Super Cache, Donncha O Caoimhm, modified the plugin to allow mobile developers to add a filter to their code that would tell WP Super Cache to cache and serve data differently depending on certain variables, but no one quite picked up on it or modified their plugin to work in conjunction with WP Super Cache. And since WordPress almost isn’t worth running without WP Super Cache, it was sort of a wash.
A New Hope, Another Failure
As you may recall, I thought I had found a solution in the form of the WordPress Mobile plugin earlier this month, but it too failed. The problem is that you don’t just want a different stylesheet for mobile content; if that was all, there’d be no issue because WP Super Cache doesn’t cache styles, just content. But on mobile devices, you don’t have room or time to load everything, so you really only want to serve the content that is pertinent (blogrolls, for instance, might be nice, but you don’t want to have to scroll past that on a tiny mobile screen). Therefore, plugins that serve content to mobile devices also use a different theme for those devices, and when that theme gets cached, it then ends up being displayed to regular web browsers. WordPress Mobile, like all the other mobile plugins, weren’t using the filter in WP Super Cache to cache and serve their content appropriately.
Eureka! At last!
Donncha has just released version 0.9 of WP Super Cache, however, and this one takes into account user agent strings to identify mobile browsers by using the detection code from Alex King’s WordPress Mobile Edition. I began testing this on SilverPen yesterday using developmental versions of both WP Super Cache and WordPress Mobile Edition, and after identifying and working out a single bug (Donncha worked it out, of course, not me!) it appears to be working great! We ran into a snag where Safari on Mac was being identified as a mobile browser, but Donncha had that fixed before I could even get him the log files.
A new version of WordPress Mobile Edition has not yet been released, and I’m not entirely sure it needs to be. The caching and UA checks are being handled by WP Super Cache now to decide what to cache and serve, so not only should your choice of mobile plugin be irrelevant, it should also Just Work™.
Give it a try and let me know what you think!