Disable Lightbox 2 for WordPress Mobile
July 03, 2010
Since we generally want to keep mobile versions of websites lightweight, it makes sense to disable as much eye candy and JavaScript as possible. I personally use Lightbox 2 for image overlays and WordPress Mobile Edition to detect mobile devices. The two plugins obviously to not play well together. The easiest solution I came up with is to plop the following code snippet at the top of lightbox2.php
:
if(isset($_COOKIE["cf_mobile"]) && $_COOKIE["cf_mobile"] == "true") { return; }
This method can be used to effectively disable any plugin while browsing from a mobile device.