I'm trying to prevent loading of extra site menus on mobile. I'd rather not load them at all as opposed to loading them and hiding them with css. I'm starting with this in my header file:
<?php if(wp_is_mobile()) : ?>
<?php /*?>Don't load full menus on mobile<?php */?>
<?php else : ?>
//Code for additional menus goes here
<?php endif; ?>
It works, but I pushed this change on Friday - and our site is timing out this week. It could be totally unrelated, but I found a statement in the codex that says " It also should not be used for themes." - https://codex.wordpress.org/Function_Reference/wp_is_mobile
Does this mean I can't use the function in this way? I found several references / examples like the logic I used. If not in a theme, how can I use it?
Bottom line... what is the best way to prevent loading of content on mobile?