WP Super Cache Any Mobile Theme Switcher Graphene Neo
-
I wrote a filter to integrate Graphene Neo + Any Theme Switcher + WP SuperCache, and I want share it with everybody.
It returns mobile or desktop cache classifier accordingly to the AWTS settings.
/* WP Super Cache + Any Mobile Theme Switcher + Graphene Neo */ add_cacheaction('wp_cache_check_mobile', 'custom_wp_cache_check_mobile'); function custom_wp_cache_check_mobile($cache_key) { $log_enabled = isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']; $log_prefix = '[custom_wp_cache_check_mobile] '; if ($log_enabled) { wp_cache_debug($log_prefix . 'Cache key: "' . $cache_key . '"'); wp_cache_debug($log_prefix . 'User Agent: "' . $_SERVER["HTTP_USER_AGENT"] . '"'); } if (!function_exists('amts_checkMobile')) { if ($log_enabled) { wp_cache_debug($log_prefix . 'Any Mobile Theme Switcher not installed.'); } return NULL; } $amts_mobile_check = amts_checkMobile(); if ($log_enabled) { wp_cache_debug($log_prefix . 'Any Mobile Theme Switcher returned: "' . var_export($amts_mobile_check, true) . '"'); } if ($amts_mobile_check['amts_mobile_browser'] == 'Graphene Mobile Neo') { $return = "mobile"; } else { $return = "normal"; } wp_cache_debug($log_prefix . 'Returned: "' . $return . '"'); return $return; }
https://www.ads-software.com/plugins/wp-super-cache/
https://www.ads-software.com/plugins/any-mobile-theme-switcher/
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘WP Super Cache Any Mobile Theme Switcher Graphene Neo’ is closed to new replies.