[英]How can i check to see if my WordPress code is correct?
I am trying to enqueue a script into my WordPress theme, but i have no way to tell if it is correct. 我试图将一个脚本排入我的WordPress主题,但我无法判断它是否正确。 The script isn't working, so what am i doing wrong? 脚本不起作用,所以我做错了什么?
function buns_bootstrap_js(){
wp_enqueue_script('bootstrapjs', get_stylesheet_directory() . 'js/bootstrap.min.js', array('jquery'),'3.2.0');
}
add_action('wp_enqueue_script', 'buns_bootstrap_js');
It's best to learn how to use the developer tools in Firefox (or Firebug ) or Chrome or Safari or IE to see the Javascript loading on your site and any script errors. 最好学习如何使用Firefox (或Firebug )或Chrome或Safari或IE中的开发人员工具查看您网站上的Javascript加载以及任何脚本错误。
And use Debug in WordPress https://codex.wordpress.org/Debugging_in_WordPress to check for PHP errors that may exist in your use of wp_enqueue_script
. 并使用WordPress中的Debug https://codex.wordpress.org/Debugging_in_WordPress来检查使用wp_enqueue_script
可能存在的PHP错误。
Check the docs, if needed, for wp_enqueue_script
https://codex.wordpress.org/Function_Reference/wp_enqueue_script 如果需要,请检查文档wp_enqueue_script
https://codex.wordpress.org/Function_Reference/wp_enqueue_script
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.