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 (:
2 Answers
There is wp_is_mobile()
function to conditionally display (or block) content for mobile users.
<?php if (!wp_is_mobile()) : ?>
<!-- Stuff to hide from mobile users -->
<?php endif; ?>