[Plugin: WP Super Cache] Compat. with WordPress Mobile Edition toggle link?
-
WordPress Mobile Edition lets you insert a call (see their FAQ) into your template to toggle between the regular & mobile versions on an normal (or unrecognized) browser. But, they not this functionality isn’t compatible with WP Super Cache.
I got this functionality working by adding the following to wp_cache_check_mobile (coincidentally, a function derived from WordPress Mobile Edition — trippy!)
if( !isset( $wp_cache_mobile_enabled ) || false == $wp_cache_mobile_enabled )
return $cache_key;if (!array_key_exists('cf_action', $_REQUEST) || $_REQUEST['cf_action'] != 'reject_mobile')
{
$showMobile = (isset($_REQUEST['cf_action']) && $_REQUEST['cf_action'] == 'show_mobile');
$mobile = (isset($_COOKIE['cf_mobile']) && $_COOKIE['cf_mobile'] == "true");if( $mobile || $showMobile) {
return $cache_key.'mobile';
}}
if (!isset($_SERVER["HTTP_USER_AGENT"])) {
return $cache_key;
}Well, there it is if you’re interested in adding this compatibility to WP Super Cache. I think it would be a great addition to your plugin.
- The topic ‘[Plugin: WP Super Cache] Compat. with WordPress Mobile Edition toggle link?’ is closed to new replies.