简体   繁体   English

无法将我的脚本加载到我的WordPress主题的页脚中

[英]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.

相关问题 脚本不会加载到Wordpress页脚中 - Script won't load in wordpress footer 无法在基于Bootstrap的Wordpress主题中使用下拉菜单 - Can't get my dropdown working in a Bootstrap based Wordpress theme 使Bootstrap进入我的WordPress主题-无法获得Javascript文件 - Getting Bootstrap into my WordPress theme — can't get Javascript file in 为什么在WP主题中,如果我从functions.php加载SlideShow(JQuery FlexSlider)不能工作,但是如果我从footer.php文件中加载它,则它可以工作吗? - Why in WP theme a SlideShow (JQuery FlexSlider) can't work if I load it form functions.php but work if I load it from my footer.php file? $不是函数,在我前面的脚本中(页脚中的jQuery加载) - $ is not a function, in my script on front (jQuery load in footer) 为什么wordpress无法加载我的jQuery脚本? - Why won't wordpress load my jQuery script? 我的第一个WordPress插件-无法运行脚本 - My first WordPress plugin - Can't get script to run 为什么我的Web应用程序无法加载此脚本? - Why can't my web app load this script? 为什么在WordPress中我无法使用functions.php文件中的钩子来加载JavaScript? - Why in WordPress I can't load my JavaScripts using an hook inside my functions.php file? jQuery代码段在我的wordpress主题中不起作用 - jQuery snippet don't work in my wordpress theme
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM