如何在父主题CSS之后加载Wordpress子主题CSS [英] How to load wordpress child theme css after parent theme css

查看:390
本文介绍了如何在父主题CSS之后加载Wordpress子主题CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在主主题css之前加载的我的wordpress子主题css文件中。
我的孩子主题css functions.php文件在下面给出

In my wordpress child theme css file loaded before main theme css. My child theme css functions.php file is given below

function my_theme_enqueue_styles(){
  wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/../enfold-child/plugins/bootstrap/css/bootstrap.min.css' );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );

我想在父主题CSS之后加载子主题CSS。

I want to load child theme css after parent theme css.

推荐答案

添加优先级。这里是99,这很可能是最后一个,但是有些插件可能会以更高的优先级添加css,尽管这种情况很少见。

Add the priority. Here 99 is high, so it will likely be last but some plugins may add css at a higher priority, though it's rare.

function my_theme_enqueue_styles(){
  wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/../enfold-child/plugins/bootstrap/css/bootstrap.min.css' );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles', 99 );

请参阅: https://developer.wordpress.org/reference/functions/add_action/

这篇关于如何在父主题CSS之后加载Wordpress子主题CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆