自定义函数wordpress在页脚而不是页眉中排列脚本
我可以在页眉中使用它,但如何在页脚中使用它。我在wordpress上使用论文框架自定义函数wordpress在页脚而不是页眉中排列脚本,wordpress,scripting,footer,Wordpress,Scripting,Footer,我可以在页眉中使用它,但如何在页脚中使用它。我在wordpress上使用论文框架 function load_scripts() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'http://code.jquery.com/jquery-1.7.2.min.js'); wp_enqueue_script( 'jquery'); wp_register_script( 'boots
function load_scripts() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://code.jquery.com/jquery-1.7.2.min.js');
wp_enqueue_script( 'jquery');
wp_register_script( 'bootstrap', '/wp-content/themes/thesis/custom/js/bootstrap.min.js', true);
wp_enqueue_script( 'bootstrap');
}
add_action('wp_enqueue_scripts', 'load_scripts');
我把它变成了现实,但它似乎不起作用。我一直在用这个作为参考。
wp_enqueue_脚本($handle、$src、$deps、$ver、$in_footer) 看起来您在错误的位置传递了
true
——WordPress会将其解释为$deps
的值。虽然$deps
是可选的,但如果要指定后续参数,则需要提供它。告诉您默认值-只需传递这些值
因此,您的wp\u register\u脚本调用应该是:
wp_register_script( 'bootstrap', '/wp-content/themes/thesis/custom/js/bootstrap.min.js', array(), false, true);
可能值得用来获取模板目录,而不是硬编码