I'm trying to defer javascript on zara theme
For that i add this code into theme function.php
function minify_js_files( $url ) {
if ( is_user_logged_in() ) return $url; //don't break WP Admin
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'min.js' ) ) return $url;
return str_replace( ' src', ' defer src', $url );
}
osc_add_hook( 'minify-js', 'minify_js_files', 1 );
after i run hook
minify-js in footer
But seems it's not working....
The question is, how can i defer parsing of javascripp in zara theme?
There is any suggestion abou t how can defer javascript?
?
Best Regards
João