Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #2338950
Mega Menu Images showing in Code for Mobile Devices
Closed

Comments

  •  4
    scottpaul70 started the conversation

    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

  •  2,699
    PenciDesign replied

    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

  •  4
    scottpaul70 replied

    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.

  •  2,699
    PenciDesign replied

    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