Javascript 无法在Wordpress中加载js脚本
我试图从我的自定义Wordpress主题获得js中的两个自定义脚本。 我在Javascript 无法在Wordpress中加载js脚本,javascript,php,wordpress,Javascript,Php,Wordpress,我试图从我的自定义Wordpress主题获得js中的两个自定义脚本。 我在functions.php add_action( 'wp_enqueue_scripts', 'add_my_script' ); function add_my_script() { wp_register_script('html2Canvas',get_template_directory_uri() .'/js/html2canvas.js', array('jquery'),true); wp_re
functions.php
add_action( 'wp_enqueue_scripts', 'add_my_script' );
function add_my_script() {
wp_register_script('html2Canvas',get_template_directory_uri() .'/js/html2canvas.js', array('jquery'),true);
wp_register_script('CustomController',get_template_directory_uri() . '/js/CustomController.js', array('jquery','html2canvas'),true);
wp_enqueue_script('html2Canvas');
wp_enqueue_script('CustomController');
}
followin文件夹结构中的
<theme_folder>
|- functions.php
|-js
|- html2canvas.js
|- CustomController.js
|[...]
|-functions.php
|-js
|-html2canvas.js
|-CustomController.js
|[...]
浏览器控制台中出现错误?控制台或dockers日志中没有错误您是否在footer.php中编写了wp_footer()?太好了!谢谢您的评论@AndrewSchultz