Is there a way I can not show something to mobile users? I have a floating social bar on my responsive theme, but it get in the middle of the content if I’m on my Android phone.
I don’t want to use display:none, since the JS will still load. Is there a function I can use to only show the floating bar for desktops users, and not mobile ones?
Thanks in advance (:
There is
wp_is_mobile()
function to conditionally display (or block) content for mobile users.Yes. Using CSS won’t prevent JS from loading generally but it’s more reliable than server side sniffing. Depends on project but I would go with media queries to just hide it or bring it in page’s content flow.