Closed fabienlege closed 7 years ago
Hi,
Can you provide screenshot? Thanks!
Cheers, Jeffrey
You're just hiding the widget areas with CSS. You should be checking whether the device is mobile, tablet or desktop, before outputting your widget. If it is to be "hidden" on the device, don't output it at all, as it only consumes bandwidth, load time, etc.
I'd suggest using require_once 'Mobile_Detect.php';
(you can download the script here) and use the Mobile_Detect
class in your plugin. Please be sure to check if the class already exists before inclusion though, so you don't break any of my plugins like one other author did. ;)
Yes! It's best to hide widget via CSS media query to be compatible with caching plugins. No need to other third-party script. If you want to use PHP condition, you can use the Display Widget Logic option and add wp_is_mobile()
. I hope this can fix your issue. Thanks!
Cheers, Jeffrey
I see. Yes, I suppose that's workable. Thanks for bringing up that point and for the workaround for those who don't want to bother with caching.
@joerhoney you are very welcome :) Feel free to let me know if you have any other questions. Will be closing this ticket now. Thanks!
Cheers, Jeffrey
Try to check hide on mobile => widget visible everywhere Try to check hide on desktop => widget visible everywhere Try to check show on desktop => widget visible everywhere Try to check show/hide on anything => widget visible everywhere in any case