Quantcast
Viewing all articles
Browse latest Browse all 19292

msteel@napco.com on "W3 Total Cache & Mobile Theme Switching"

I've been researching this on an off for a couple of years and am finally in absolute need of it. I've seen lots of posts about people wanting this feature but no results.

I hate to alter the plugin but going through the code I've found onc place to make a simple override.

In /wp-content/plugins/w3-total-cache/lib/W3/mobile change line 21 from

return isset($_SERVER['HTTP_USER_AGENT']) && preg_match('~' . $group_compare_value . '~i', $_SERVER['HTTP_USER_AGENT']);

to

return isset($_SERVER['HTTP_USER_AGENT']) && preg_match('~' . $group_compare_value . '~i', $_SERVER['HTTP_USER_AGENT']) && ! isset( $_COOKIE['w3tc_mobile_override'] );

Then you just need to write the code to set and delete the cookie.

I haven't decided whether to take this approach, but it seems to be the most non-invasive way to handle this.

(also I tried to apply a filter to the cookie name but it kept causing a fatal error, could be this code is being called before that functionality is loaded)


Viewing all articles
Browse latest Browse all 19292

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>