[Plugin: Black Studio Touch Dropdown Menu] Decide with wp_is_mobile() if plugin adds code at all?
-
Another idea:
Would it be possible that the plugin does not call
wp_enqueue_script()
andwp_localize_script()
if not on a mobile device? Some sites do not use jquery, so the extra loading could be avoided if not required.WordPress since 3.4 has a function
wp_is_mobile()
which checks the useragent for certain values and returns a boolean.The existing checks for IOS etc. in
.js
would stay there of course.http://codex.wordpress.org/Function_Reference/wp_is_mobile
http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/vars.php#L106Not sure how “safe”
wp_is_mobile()
is for detection, maybe does not detect enough(?), and probably there should be afunction_exists('wp_is_mobile')
as well for older WordPress versions…http://wordpress.org/extend/plugins/black-studio-touch-dropdown-menu/
- The topic ‘[Plugin: Black Studio Touch Dropdown Menu] Decide with wp_is_mobile() if plugin adds code at all?’ is closed to new replies.