我正在尝试从 wordpress 父主题中取出一个缩小的 js 文件。似乎无法弄清楚如何将我自己的自定义 js 文件从子主题中出列然后入队。
这是我的代码:
add_action( 'wp_enqueue_scripts', 'my_remove_scripts', 20 );
function my_remove_scripts(){
wp_dequeue_script( 'custom' );
}
add_action('wp_enqueue_scripts', 'my_add_scripts');
function my_add_scripts(){
wp_enqueue_script('custom-child', get_template_directory_uri() . '/js/custom'.$js_minify_prefix.'.js', array('jquery'), THEME_VERSION, true);
}
父主题中的脚本是这样排队的:
wp_enqueue_script('custom', get_template_directory_uri() . '/js/custom'.$js_minify_prefix.'.js', array('jquery'), THEME_VERSION, true);
代码中是否缺少某些内容,或者是否有一种特殊的出列/入列缩小脚本的方法?任何帮助,将不胜感激!!:)