Disable a PHP Plugin on mobile Screens with Code? -
i have plugin called "wp float", want disable when detects small screen size, lets smaller 400px. there line of php code can paste in 1 of plugin's files make happen?
these files plugin:
wp-float/wp-float(.)php
wp-float/readme(.)txt
wp-float/js/jquery.hoverintent.minified(.)js
wp-float/js/jquery.easing(.)js
wp-float/js/wp-float-button(.)js
wp-float/js/jquery.floater.2.2(.)js
wp-float/js/button-wpfloat(.)php
what paste , in file? thanks
as nicolas said, there's no way access client screen size on server side unless have sent information client side, javascript example.
but, headers brings nice information. so, if you're looking disable for, let's say, mobile devices, can assume won't have big screen, can try reading headers of request browser's agent, lets say, in php:
if (preg_match('/iphone|android|blackberry|nokia/i'),$_server['http_user_agent'])) echo "looks small screen device...";
you try php class detecting mobile devices: http://code.google.com/p/php-mobile-detect/
later can this
require_once 'mobile_detect.php'; $detect = new mobile_detect; if ($detect->ismobile()) { echo "it's phone or tablet"; } if($detect->istablet()){ echo "it's tablet"; } if ($detect->ismobile() && !$detect->istablet()) { echo "it's phone ;)"; }
Comments
Post a Comment