Skip to content
Public Ticket #11669

Mega Menu Images showing in Code for Mobile Devices

Conversation thread

PenciDesign replied

Staff Reply

Hi,

If so, please add this codes:

<?php if( ! wp_is_mobile() ) {  ?>

And:

<?php } ?>

like on this image: http://prntscr.com/rp5wd5

Best Regards,

PenciDesign

scottpaul70 replied

Customer Reply

Hello,

Thanks for the reply. While this worked to remove the mega menu images from the code it also removed all the sub menu links from mobile where the mega menu images were being used. Please let me know how we can keep the submenu links and remove the mega menu images from the from the code.

PenciDesign replied

Staff Reply

Hi,

To do that, you can use function wp_is_mobile() from WordPress - let's add more this code:

if( wp_is_mobile() ): return ''; endif;

like on this image.

But the function wp_is_mobile() will detect your site on real mobile - so maybe you can't see the source hidden on mobile when use google page speed test.

Best Regards,

PenciDesign

scottpaul70 started the conversation

Conversation Start

Hello,

I would like to remove the mega menu images (posts featured image) from showing in the source code on mobile devices. The mega menu images for posts work great on desktop and they do not visually show in the menus for mobile devices. The issue is that the images source is still in the code and they are drastically reducing my loading time and giving poor Google Page Speed results as well. If you visit our site you will see what I mean.

https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fwww.deckstainhelp.com%2F&tab=mobile

Please let me know how I can remove the images for the mega menus from loading in the code for mobile devices.

Thanks

Want to join this conversation or access attachments? Sign in first.