我已将所有脚本排入函数队列。php通过将“true”传递给第五个参数,在标记之前加载。它对所有人都有效,但jquery除外,你知道我做错了什么吗?
wp_enqueue_script(\'jquery\',\'\',\'\',\'\',true);
wp_enqueue_script(\'modernizr\', \'http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.js\', array(\'jquery\'), false, true);
wp_enqueue_script(\'my-javascript\', get_template_directory_uri() . \'/js/my-javascript.js\', array(\'jquery\', \'modernizr\'), false, true);
wp_enqueue_script(\'jquery-ui\', get_template_directory_uri() . \'/js/jquery-ui.min.js\', array(\'jquery\'), false, true);
SO网友:user53340
尝试将其添加到函数中。php
<?php
// Custom scripting to move JavaScript from the head to the footer
function remove_head_scripts()
{
remove_action(\'wp_head\', \'wp_print_scripts\');
remove_action(\'wp_head\', \'wp_print_head_scripts\', 9);
remove_action(\'wp_head\', \'wp_enqueue_scripts\', 1);
add_action(\'wp_footer\', \'wp_print_scripts\', 5);
add_action(\'wp_footer\', \'wp_enqueue_scripts\', 5);
add_action(\'wp_footer\', \'wp_print_head_scripts\', 5);
}
add_action(\'wp_enqueue_scripts\', \'remove_head_scripts\');
?>