WordPress Functions.php file doesn't enqueue anything
我不知道为什么,但是我的functions.php文件没有加载任何脚本/样式。这是我的functions.php文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <?php function promotie_load_styles() { /* If this is the admin area of WordPress, don't do anything */ if( is_admin() ) return; wp_enqueue_script('latest-jquery','https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'); wp_enqueue_style('fonts', 'http://fonts.googleapis.com/css?family=PT+Sans'); wp_register_style('style', get_template_directory_uri() . '/style.css'); wp_enqueue_style('style'); wp_register_script('html5shiv', 'https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js'); wp_enqueue_script('html5shiv'); wp_register_script('respond','https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js'); wp_enqueue_script('respond'); // bootstrap stuff wp_register_script('bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js'); wp_enqueue_script('bootstrap-js'); wp_register_style('bootstrap-css', '//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'); wp_enqueue_style('bootstrap-css'); } add_action('wp_enqueue_scripts', 'promotie_load_styles'); |
这是什么问题?我只是向wp_enqueue_scripts添加操作并排队脚本/样式,但是当我检查页面并转到参考资料时,那里什么也没有,样式,脚本也没??有。
EDIT1:另一个奇怪的事情是,我的主题曾经在没有functions.php文件的情况下工作,在阅读有关排队的更多信息之前,我将脚本加载到了标头中。现在,我创建了functions.php,并且没有正确导入任何内容。我在此处添加了一些随机文本,并且没有错误返回,并且如果我在函数外部键入内容,则会在html页面中产生回显。
我的猜测是某个地方有错误,但是我不知道如何调试它,我在wp-config中将WP_DEBUG设置为true,我真的不知道该怎么办。 >
您很有可能在
中丢失了