我的 Moo Tools 脚本在我将它们放入我的 functions.php 时出错,但当我将它们放入我的 header.php 时工作正常
header.php 中的工作原理
<script type='text/javascript' src='http://minnebyte.com/wp-
content/themes/mb/js/mootools-1.2-more.js?ver=3.5'></script>
<script type='text/javascript' src='http://minnebyte.com/wp-
content/themes/mb/js/mootools-fluid16-autoselect.js?ver=3.5'></script>
<script type='text/javascript' src='http://minnebyte.com/wp-
content/themes/mb/js/mootools-1.2.1-core.js?ver=3.5'></script>
什么在functions.php中不起作用
// Basic Scripts
function MB_scripts()
{
wp_deregister_script('mootools-1.2-more');
wp_register_script('mootools-1.2-more', MB_PATH.'/js/mootools-1.2-more.js');
wp_enqueue_script('mootools-1.2-more');
wp_deregister_script('mootools-fluid16-autoselect');
wp_register_script('mootools-fluid16-autoselect', MB_PATH.'/js/mootools-fluid16-
autoselect.js');
wp_enqueue_script('mootools-fluid16-autoselect');
wp_deregister_script('mootools-1.2.1');
wp_register_script('mootools-1.2.1', MB_PATH.'/js/mootools-1.2.1-core.js');
wp_enqueue_script('mootools-1.2.1');
}
add_action( 'wp_enqueue_scripts', 'MB_scripts' );
将它们放在functions.php中不是一个好习惯吗? 啧啧
链接到 我的页面
在开发者工具中查看以查看错误
谢谢您的帮助!