This topic has 8 replies, 2 voices, and was last updated 6 years, 3 months ago ago by Olga Barlow
Hi Team
Has there been any change in version 4.28 regarding javascripts?
I ask why I use defer, excluding the files below for a long time with the theme:
if (!(is_admin() )) {
function defer_parsing_of_js ( $url ) {
if ( FALSE === strpos( $url, ‘.js’ ) ) return $url;
if ( strpos( $url, ‘jquery.js’ ) ) return $url;
if ( strpos( $url, ‘jquery.min.js’ ) ) return $url;
if ( strpos( $url, ‘head.min.js’ ) ) return $url;
return “$url’ defer=’defer”;
}
But when upgrading to version 4.28, I noticed that the first image of the products in swap mode ends up going blank.
Removing the defer everything returns to normal. I use the function because the wp rocket does not adapt well activating the defer loading
Best regards
Rudimar
Hello,
No, we did not make changes of scripts in 4.28 version of XStore theme.
Regards
Thanks Olga, sorry for delay.
I tried for a few times to go to 4.28 but the error reappeared, the store images are blank appearing only the second image of the swap when the mouse is passed.
I’ll try again as this store is in production the time to test it is pretty limited. now running 4.27 again.
I even saved a screen of error:
Thanks
Rudimar
Hello,
I see. It’s difficult to find out why this happened from the screenshot, maybe compatibility with some plugin that you use. You may create a staging site and provide us with access. I’ll pass it to our developers to check.
Regards
Hi Olga
I did what I could to try to isolate the problem 🙂
I ended up isolating folders and files and I found the problem.
It is in the file /xstore/theme/theme-setup.php
These lines have been included and they cause the flurry of errors when using defer in wprocket or theme functions. The swap images do not appear, nor do the sliders spin.
// Remove query string from static files
function remove_cssjs_ver ($ src) {
// Do not do it for revslider and essential-grid.
if (strpos ($ src, ‘revslider’) || strpos ($ src, ‘essential-grid’)) return esc_url ($ src);
if (strpos ($ src, ‘? ver =’))
$ src = remove_query_arg (‘view’, $ src);
return esc_url ($ src);
}
add_filter (‘style_loader_src’, ‘remove_cssjs_ver’, 10, 2);
add_filter (‘script_loader_src’, ‘remove_cssjs_ver’, 10, 2);
}
}
So now I’m running with theme 4.28.1 and this file left the 4.27 and everything works perfectly on PHP 7.2.7 🙂
Perhaps it would be better to leave each option to the user.
Regards
Rudimar
Hello,
I have passed your request to our developers. Maybe they will be able to solve these moments.
Regards
Thanks Olga
You are the best 🙂
I confirm, without these lines is working fine. I using defer on functions php theme.
Regards
Rudimar
Ok 😉
Regards
You must be logged in to reply to this topic.Log in/Sign up