- This topic has 21 replies, 3 voices, and was last updated 1 year, 1 month ago by
David.
-
AuthorPosts
-
March 3, 2020 at 10:18 pm #1184294
Azman
I am using a CDN to optimize and serve my images. And it compresses all the images on my website. It even compresses the logo, which I don’t want to compress.
So, to avoid this they asked me to add this attribute to the logo image tag: data-gumlet=”false”
And I have no clue on how to do it. Please help.
March 4, 2020 at 3:18 am #1184481David
StaffCustomer SupportHi there,
try adding this PHP Snippet:
add_filter( 'generate_navigation_logo_output', function() { return sprintf( '<div class="site-logo sticky-logo navigation-logo"> <a href="%1$s" title="%2$s" rel="home"> <img data-gumlet="false" src="%3$s" 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_navigation_logo', $settings['sticky_menu_logo'] ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ) ); } );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 4, 2020 at 4:25 am #1184544Azman
Thanks David, but how and where to add this PHP script?
March 4, 2020 at 4:28 am #1184546David
StaffCustomer SupportThis article explains:
https://docs.generatepress.com/article/adding-php/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 4, 2020 at 11:41 pm #1185467Azman
I added the script using the Code Snippet plugin, but the logo is still getting compressed.
March 5, 2020 at 2:47 am #1185581David
StaffCustomer SupportHow did you add the code ?
If you have removed it can you re-add it.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 5, 2020 at 3:35 am #1185623Azman
I have added it using Code Snippet plugin, and it is still live with “Run Snippet Everywhere” enabled.
March 5, 2020 at 3:53 am #1185641David
StaffCustomer SupportTry this snippet instead:
add_filter( 'generate_logo_output', 'tu_logo_class', 10, 3 ); function tu_logo_class( $output, $logo_url, $html_attr ) { printf( '<div class="navigation-branding"> <div class="site-logo"> <a href="%1$s" title="%2$s" rel="home"> <img data-gumlet="false" data-gmlazy="false" %3$s /> </a> </div> </div>', esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ), $html_attr ); }
It may require some CSS for sizing – so add the code and let know.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 5, 2020 at 4:04 am #1185650Azman
Done that! Yes, now it needs CSS. Please look into it.
March 5, 2020 at 5:41 am #1185732David
StaffCustomer SupportAdd this CSS:
.site-logo img { max-width: 200px; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 5, 2020 at 6:26 am #1185784Azman
David, it’s good now, but it break the order of navigation menu, I guess.
Checkout by clicking on one of the blog post and scroll.By the way, you helped me achieve that navigation – https://generatepress.com/forums/topic/redesigned-header-navigation-like-verywellfit/
March 5, 2020 at 6:36 am #1185792David
StaffCustomer SupportI made an edit to this code
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 5, 2020 at 6:53 am #1185973Azman
Now again it is getting served by the CDN.
March 5, 2020 at 6:55 am #1185978David
StaffCustomer SupportOops – made another change.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 5, 2020 at 8:14 am #1186081Azman
Now the logo goes completely missing…
-
AuthorPosts
- You must be logged in to reply to this topic.