I’m looking at my site on an Android Motorola Mini, and Chrome (29.0.1547.72). Turning on the debug in footer, I get a message saying “? This could be the Tablet version of this blog (desktop) ?”
And my conditional is_mobile code is failing.
https://www.ads-software.com/plugins/mobile-client-detection-plugin/
]]>I want to disable a (different) plugin for mobile devices. Is it possible?
https://www.ads-software.com/extend/plugins/mobile-client-detection-plugin/
]]>I’ve got an odd case where all browsers on Windows machines render a site one way, and all mac browsers render the site differently.
I want to use this plugin, and query_vars, to load an extra stylesheet if the platform is Windows. Can someone tell me how this should be phrased? I’ve tried the following, but it does not work. My code editor says there is an error in the 4th line.
<?php
if(get_query_var('platform')){
$platform = get_query_var('platform');
if $platform = 'windows' { ?>
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_directory' ); ?>/pc.css" />
<?php }
} ?>
https://www.ads-software.com/extend/plugins/mobile-client-detection-plugin/
]]>I added the mobile client detection plug in to help with mobile devices. It seems to work but has added this at the bottom of the page:
Should I try to remove it or leave it?
? This could be the Windows x86 version of this blog (IE9) ?General Results Only: NoCreate query_vars: NoStandard 0: Webly/page.php (active)Template 1: /home/magical/public_html/wp-content/themes/Webly/page.phpTheme 2: /home/magical/public_html/wp-content/themes/Webly/page.php
Is there a way to remove this or use another mobile device plug in? The site is https://www.magicalminiatures.net
https://www.ads-software.com/extend/plugins/mobile-client-detection-plugin/
]]>Firefox for Android formats the platform in its user agent differently to other common Android browsers, and the regex in mcd_get_platform() can’t cope with that at present. The patch at https://pastebin.com/UNh5We6x adds support for the Firefox format, including the ability to distinguish between mobile and tablet (which, happily, is extremely easy with the Firefox format).
https://www.ads-software.com/extend/plugins/mobile-client-detection-plugin/
]]>All Android 4.0 devices are currently detected as tablets in MCD 0.9.0. The following (admittedly lightly tested) patch seems to fix this for me, both in the stock browser and Chrome:
[Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]
Please let me know if you’d prefer to get the patch in another format.
https://www.ads-software.com/extend/plugins/mobile-client-detection-plugin/
]]>Currently the is_desktop(), is_mobile() and is_tablet() are defined from the query_vars that are set in this plugin. When you want to use these functions before the initiation of WP_Query they return false, because the query_vars aren’t set yet. I suggest to change the functions (bottom of mobile_client_detection.php) as follows, from
function is_desktop(){return((get_query_var('platform')=='desktop')? true : false);} function is_mobile(){return((get_query_var('platform')=='mobile')? true : false);} function is_tablet(){return((get_query_var('platform')=='tablet')? true : false);}
to
function is_desktop(){return((mcd_get_platform()=='desktop')? true : false);} function is_mobile(){return((mcd_get_platform()=='mobile')? true : false);} function is_tablet(){return((mcd_get_platform()=='tablet')? true : false);}
where I use the mcd_get_platform function, called in this plugin to read the $_SERVER[‘HTTP_USER_AGENT’] variable.
Using these changes, you’re able to use these functions in, for example, the wp_enqueue_scripts hook that’s used in the wp_head() to set device specific scripts.
https://www.ads-software.com/extend/plugins/mobile-client-detection-plugin/
]]>We discovered that the “Add query_vars” form field was saving/displaying the opposite of what it should. Here’s a fix:
Before (starting at line 327 in mobile_client_detection.php)
<h3>Add query_vars 'platform' & 'browser':</h3>
<select id="add_vars" name="add_vars">
<option value="0"<?php echo(($mcd_options[3]==1)?' selected="selected"':'');?>>Yes</option>
<option value="1"<?php echo(($mcd_options[3]==0)?' selected="selected"':'');?>>No</option>
</select>
Fix (starting at line 327 in mobile_client_detection.php)
<h3>Add query_vars 'platform' & 'browser':</h3>
<select id="add_vars" name="add_vars">
<option value="0"<?php echo(($mcd_options[3]==0)?' selected="selected"':'');?>>No</option>
<option value="1"<?php echo(($mcd_options[3]==1)?' selected="selected"':'');?>>Yes</option>
</select>
https://www.ads-software.com/extend/plugins/mobile-client-detection-plugin/
]]>Can this plugin detect/differentiate between Android phones and tablets? I’ve been disappointed with similar plugin’s inability to distinguish between at small format Android phone and a 10″ Android tablet for purposes of delivering a customized theme or css.
https://www.ads-software.com/extend/plugins/mobile-client-detection-plugin/
]]>