Tagged: cache, mobile logo
-
AuthorPosts
-
November 3, 2022 at 10:38 pm #1371285
Hello,
I use the following code to display a different logo on mobile:
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(wp_is_mobile() ) { $logo = "link1"; } return $logo; }
However, after I installed WP Super Cache, the retina logo is not replaced by the mobile logo on mobile devices if the page was first cached on desktop: please see the link2 on mobile device or emulator.
Thank you,
MarinaNovember 4, 2022 at 5:08 am #1371295Hey Marina,
Thank you for the inquiry.
The logo image is replaced with a picture tag with the class name sp-no-webp. Did you install a webp plugin? The plugin might be replacing the default logo tag with its own markup voiding the changes in the avf_logo filter.
Best regards,
IsmaelNovember 4, 2022 at 6:55 pm #1371367Hello,
The WebP images are delivered by ShortPixel, I disabled the ShortPixel optimization for the logo image and tried to disable the plugin in general, but this did not help. The problem is with caching: the initially cached version of logo remains for all screen sizes. I give you the credentials for the site, please test with clearing cache, producing cache, and viewing the main page on desktop and then on mobile emulator. I tried a different caching plugin – the issue remains. When caching is disabled – everything works as it should.
Best regards,
MarinaNovember 4, 2022 at 10:12 pm #1371384Hello,
I think I solved the issue: instead of using a filter in functions.php, I use the following code I’ve found online in Quick CSS:
@media only screen and (max-width: 480px) { .logo img { opacity: 0; } .logo a { background-image: url(https://kriesi.at/wp-content/themes/kriesi/images/logo.png); background-repeat: no-repeat; background-size: contain; background-position: 0% 50%; }}
With this solution everything works when caching is enabled. Thank you, you can close the ticket.
Best regards,
MarinaNovember 7, 2022 at 8:16 am #1371616 -
AuthorPosts
- The topic ‘Mobile logo when using WP Super Cache’ is closed to new replies.