Hi Bertrand66,
Thank you for your feedback! Right now there is no code to hide a widget on mobile, it might appear in the next versions though.
It is very complicated. I don’t know any other way that just detect the browser and environment. I made this function, which covers most mobile browsers:
function tap_is_mobile(){
global $_SERVER;
$Firefox=strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Firefox’);
$Tablet=strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Tablet’);
$Android=strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Android’);
$Chrome=strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Chrome’);
$iPad=strpos($_SERVER[‘HTTP_USER_AGENT’], ‘iPad’);
$iPhone=strpos($_SERVER[‘HTTP_USER_AGENT’], ‘iPhone’);
$mobile=($Chrome && $Android) || ($Firefox &&($Android || $Tablet)) || $iPad || $iPhone;
return $mobile;
}
Can I use is_tap_mobile() with this plugin?
-
This reply was modified 6 years, 8 months ago by
tapiohuuhaa.
-
This reply was modified 6 years, 8 months ago by
tapiohuuhaa.
Thanks, for info I was able to do my settings with Widget Options, but their conditional behaviour is not as good as Widget Logic.
I tested with widget logic tap_is_mobile() – it worked OK. Setting my own function as condition, the widget was shown only in mobile devices and not on desktop devices.
I use normally Widget Context plugin because I use much my own PHP code with Code Snippet.
But I just tested that I could use also my own functions for limiting visibility.
I can now set something to show only on mobile/computer by using the function, I created instead of hiding something with CSS.
With your own conditions you can set as exact conditions as you need.
I deactivated widget logic now because there is only one issue, which I would need it and I have hided an element with CSS on mobile.
Maybe I active it and limite visibility for mobile with this plugin, where I can.
@tapiohuuhaa – How did you end up? I would like to have a widget disabled on server-site for Mobile devices, instead of with fx. Javascript or CSS.
See above – I can’t explain better.