我有两个需要排队的脚本。我想在小胡子模板脚本之后加载子主题的脚本。即使在指定优先级时,子主题的脚本也会在Mustache脚本之前加载。
现在加载顺序:load_lh_script
, load_external_script
如何将此脚本加载顺序更正为如下所示?
load_external_script
load_lh_script
function load_external_script()
wp_register_script(\'mustache\',\'https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.3.0/mustache.min.js\',null,null,false);
wp_enqueue_script(\'mustache\');
wp_enqueue_style(\'parent-style\', get_template_directory_uri() . \'/style.css\');
wp_register_script(\'jqflip\',\'https://cdnjs.cloudflare.com/ajax/libs/jQuery-Flip/1.1.2/jquery.flip.min.js\',null,null,false);
wp_enqueue_script(\'jqflip\');
}
add_action(\'wp_enqueue_scripts\',\'load_external_script\',10);
function load_lh_script() {
wp_register_script(\'theme_js\',get_stylesheet_directory_uri() . \'/js/lh.js\',array(), \'1.0.0\',false);
wp_enqueue_script(\'theme_js\');
}
add_action(\'wp_enqueue_scripts\',\'load_lh_script\',20);