- This topic has 8 replies, 2 voices, and was last updated 5 years, 5 months ago by
Leo.
-
AuthorPosts
-
April 11, 2020 at 9:32 am #1235375
Mindy
Hello,
I am using WP Rocket and the “lazy load images” option.
This is creating an issue for the mobile sticky menu where it is not loading correctly initially.
WP Rocket has an image class solution as can be seen here: https://docs.wp-rocket.me/article/15-disabling-lazy-load-on-specific-images
How can I add this image class to the logo image? (If possible)
Thank you!! 🙂
April 11, 2020 at 9:59 am #1235410Leo
StaffCustomer SupportHi there,
Try this:
https://docs.generatepress.com/article/generate_mobile_header_logo_output/Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know if this helps 🙂
April 11, 2020 at 11:15 am #1235496Mindy
Hi Leo, so far this is not working for me, even after clearing the cache. Is it possible that adjustments need to be made since I am using the sticky menu on mobile?
Just thought I would ask, thank you!
April 11, 2020 at 11:55 am #1235539Leo
StaffCustomer SupportPossible. Try excluding this class:
sticky-navigation-logo
April 11, 2020 at 12:07 pm #1235544Mindy
Thanks Leo, this is what I have and it is not working, but I probably am misunderstanding something lol:
add_filter( 'generate_mobile_header_logo_output', function( $output ) { if ( ! function_exists( 'generate_menu_plus_get_defaults' ) ) { return $output; } $settings = wp_parse_args( get_option( 'generate_menu_plus_settings', array() ), generate_menu_plus_get_defaults() ); return sprintf( '<div class="sticky-navigation-logo"> <a href="%1$s" title="%2$s" rel="home"> <img src="%3$s" data-no-lazy="1" alt="%4$s" /> </a> </div>', esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ), esc_url( apply_filters( 'generate_mobile_header_logo', $settings['mobile_header_logo'] ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ) ); } );
April 11, 2020 at 4:15 pm #1235691Leo
StaffCustomer SupportSorry I thought you were going to use the solution WP Rocket provided?
April 11, 2020 at 4:22 pm #1235711Mindy
Ha, I knew I was misunderstanding something. I thought the article you linked was in place of the WP Rocket solution.
I am not really sure what php code I should be using to solve my issue. Sorry to be a pain, but if you could be more specific in what code I should try, that would be amazing! Thank you very much!!
April 12, 2020 at 5:13 am #1236064Mindy
This is resolved! WP Rocket went me a file name specific php code to use.
Thank you, as always Leo!
April 12, 2020 at 9:27 am #1236361Leo
StaffCustomer SupportNo problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.