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,
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