我已经设法将一个 js 文件添加到 WP functions.php 中,并且效果很好。如何添加另一个?例如将classie.js 添加到add_my_script 函数?我试图复制 get_template_directory_uri() 但这没有用 - 我觉得答案好像在盯着我!
add_action( 'wp_enqueue_scripts', 'add_my_script' );
function add_my_script() {
wp_enqueue_script(
'slicknav',// name your script so that you can attach other scripts and de-register, etc.
get_template_directory_uri() . '/js/jquery.slicknav.min.js', // this is the location of your script file
array('jquery') // this array lists the scripts upon which your script depends
);
}