[英]Can't load my script into the footer of my WordPress theme
It's certainly a noob question and I assume it, but i can't even load my couple of scripts + jQuery in my footer of my WP theme. 我当然认为这是一个菜鸟问题,但我什至无法在WP主题的页脚中加载几个脚本+ jQuery。
below is the code from functions.php
: 以下是来自
functions.php
的代码:
<?php
function add_theme_scripts() {
wp_register_style('style', plugins_url('style.css', __FILE__));
wp_enqueue_script( 'jquery', get_template_directory_uri() . '/js/jquery-1.12.3.min.js', array('jquery'), '1.12.3', true);
wp_enqueue_script( 'popper', get_template_directory_uri() . '/js/popper.min.js', array('jquery'),'', true );
wp_enqueue_script( 'plugin', get_template_directory_uri() . '/js/plugin.js', array('jquery'),'', true );
wp_enqueue_script( 'main', get_template_directory_uri() . '/js/main.js', array('jquery'),'', true );
}
add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );
?>
确保在结束标签https://developer.wordpress.org/reference/functions/wp_footer/之前,在主题的footer.php中调用了wp_footer()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.