Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress在页脚中加载CSS_Wordpress_Performance_Footer - Fatal编程技术网

Wordpress在页脚中加载CSS

Wordpress在页脚中加载CSS,wordpress,performance,footer,Wordpress,Performance,Footer,我如何才能让这个函数加载我的css在页脚,而不是在谷歌页面速度的头部。我已经在谷歌上搜索过它并尝试过,但我似乎无法让它工作 function broa_script_enqueue() { wp_enqueue_style('boostrapcss', get_template_directory_uri() . '/css/bootstrap.css', array(), '4.0.0', 'all'); wp_enqueue_style('customstyle', get_

我如何才能让这个函数加载我的css在页脚,而不是在谷歌页面速度的头部。我已经在谷歌上搜索过它并尝试过,但我似乎无法让它工作

function broa_script_enqueue() {
    wp_enqueue_style('boostrapcss', get_template_directory_uri() . '/css/bootstrap.css', array(), '4.0.0', 'all');
    wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/style.css', array(), '1.0.0', 'all');
    wp_enqueue_style('animatecss', get_template_directory_uri() . '/css/animate.css', array(), '1.0.0', 'all');
}

add_action( 'wp_enqueue_scripts', 'broa_script_enqueue' ); 

更改添加操作('wp_脚本排队','broa_脚本排队');添加_操作('wp_footer','broa_script_enqueue')

更改添加操作('wp\u脚本排队','broa\u脚本排队');添加_操作('wp_footer','broa_script_enqueue')

您可以使用
get\u footer
hook。将此代码放在活动主题的function.php中

function prefix_add_footer_styles() {
    wp_enqueue_style('boostrapcss', get_template_directory_uri() . '/css/bootstrap.css', array(), '4.0.0', 'all');
    wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/style.css', array(), '1.0.0', 'all');
    wp_enqueue_style('animatecss', get_template_directory_uri() . '/css/animate.css', array(), '1.0.0', 'all');
};
add_action( 'get_footer', 'prefix_add_footer_styles' );

这里已经描述了这个问题

您可以使用
get\u footer
hook。将此代码放在活动主题的function.php中

function prefix_add_footer_styles() {
    wp_enqueue_style('boostrapcss', get_template_directory_uri() . '/css/bootstrap.css', array(), '4.0.0', 'all');
    wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/style.css', array(), '1.0.0', 'all');
    wp_enqueue_style('animatecss', get_template_directory_uri() . '/css/animate.css', array(), '1.0.0', 'all');
};
add_action( 'get_footer', 'prefix_add_footer_styles' );

这个问题在这里已经描述过了

当我这样做时('wp_enqueue_scripts','broa_script_enqueue');添加_操作('wp_footer','broa_script_enqueue');它不会加载css.function prefix\u add\u footer\u styles(),但当我这样做时,它不会出于任何原因加载我的样式。我在这里发帖之前就试过了。我没有php错误。但是这种风格不会加载;添加_操作('wp_footer','broa_script_enqueue');它不会加载css.function prefix\u add\u footer\u styles(),但当我这样做时,它不会出于任何原因加载我的样式。我在这里发帖之前就试过了。我没有php错误。但是这种风格不适合。