admin管理员组文章数量:1334689
I am trying to get my CSS files to load after the theme and plugins have been loaded using add_action(after_setup_theme, add_css_js, 100000)
function add_css_js(){
wp_enqueue_style(
'color',
trailingslashit( get_theme_root_uri() ) . 'gemtechllc/css/color.css'
);
wp_enqueue_style(
'gem',
trailingslashit( get_theme_root_uri() ) . 'gemtechllc/css/gem.css'
);
}
add_action( 'after_setup_theme', 'add_css_js', 100000);
I am trying to get my CSS files to load after the theme and plugins have been loaded using add_action(after_setup_theme, add_css_js, 100000)
function add_css_js(){
wp_enqueue_style(
'color',
trailingslashit( get_theme_root_uri() ) . 'gemtechllc/css/color.css'
);
wp_enqueue_style(
'gem',
trailingslashit( get_theme_root_uri() ) . 'gemtechllc/css/gem.css'
);
}
add_action( 'after_setup_theme', 'add_css_js', 100000);
Share
Improve this question
edited Jun 8, 2020 at 21:28
Pat J
12.4k2 gold badges28 silver badges36 bronze badges
asked Jun 6, 2020 at 21:17
McLuvinMcLuvin
1
4
|
1 Answer
Reset to default 0Sorry I am unable to comment so I have to post here.
I will give this answer as some examples and then hopefully you can use in your situation or provide further information about your exact setup.
Make sure you are using a child theme (If you are unsure about what this is please read this
In my sites I find I am using storefront a lot so an easy way to start off with child themes would be to give this one a try
Ok so now that we are on the same page in your Child theme functions.php add or un comment the following:
/** * Dequeue the Storefront Parent theme core CSS */ function sf_child_theme_dequeue_style() { wp_dequeue_style( 'storefront-style' ); wp_dequeue_style( 'storefront-woocommerce-style' ); }
Once you have that done you can add any css to your stylesheet (style.css) or even add css from within your function pages.
I really hope this helps!
If not please provide details of the theme and the function you are trying to use / call.
Cheers,
本文标签:
版权声明:本文标题:Trying to get my CSS files to load last using add_action(after_setup_theme, add_css_js, 100000) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742366032a2461262.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
add_css_js
. And the add_action needs to be like this:add_action('after_setup_theme', 'add_css_js', 100000);
– shanebp Commented Jun 6, 2020 at 21:34wp_enqueue_style()
, which allows you to define your CSS file's dependencies. – Pat J Commented Jun 6, 2020 at 21:49