我们如何让它来驱逐某些插件?我有一个通知栏,显示几秒后,但现在已停止工作?
这段代码设置了大多数延迟加载的java脚本,但是我需要它来排除两行代码或将来的其他代码,因为它工作得很好但停止插件正常工作?这是代码:
// Defer Javascripts Speed up loading for external js files wait till page loads
// Defer jQuery Parsing using the HTML5 defer property
if (!(is_admin() )) {
function defer_parsing_of_js ( $url ) {
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) ) return $url;
// return "$url' defer ";
return "$url' defer onload='";
}
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
}
我需要从延迟中排除这两行:
<script type="text/javascript" src="somescript.js" defer="" onload="">
<script type="text/javascript" src="another.js" defer="" onload="">
非常感谢T
答案 0 :(得分:0)
// Defer Javascripts Speed up loading for external js files wait till page loads
// Defer jQuery Parsing using the HTML5 defer property
if (!(is_admin() )) {
function defer_parsing_of_js ( $url ) {
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) || strpos( $url, 'jquery.c.js' ) || strpos( $url, 'wpfront-notification-bar.js' ) ) return $url;
// return "$url' defer ";
return "$url' defer onload='";
}
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
}
答案 1 :(得分:0)
// Defer Javascripts Speed up loading for external js files wait till page loads
// Defer jQuery Parsing using the HTML5 defer property
if (!(is_admin() )) {
function defer_parsing_of_js ( $url ) {
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) || strpos( $url, 'jquery.c.js' ) || strpos( $url, 'wpfront-notification-bar.js' ) ) return $url;
return "$url' defer='defer";
}
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
}