CSS order

css
Cascading Style Sheets

Here is how to load a WordPress child theme’s CSS after the parent theme’s CSS.

The trick here is to add a 1 to the add_action script, illustrated below

Functions.php

Find and edit this little bit of code in the Functions.php file:

add_action('wp_enqueue_scripts', 'enqueue_child_theme_styles', 1);
function enqueue_child_theme_styles() {
    wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
}

This way your Parent’s CSS loads first, and your Child theme will load after that. 1 is lower, loading first. 99 is higher, which makes it load last.

Isaac Adams-Hands

Full Stack Developer, Digital Marketer, and InfoSec enthusiast. He received his Bachelor’s Degree from the University of Western Sydney and his Business Diploma from Georgian College before joining various marketing positions in search portals, e-commerce, higher education, and addiction recovery services.

Follow @ twitter

Related posts

Redirect form after submit

Add the onClick values onClick values *replace f0rm with form, I didn’t want the form to render on this website.

WP Child Themes

WordPress child themes are really simple to make, but I’ve noticed most tutorials are more complicated then they need to be. All you need are two files in a folder: style.css + functions.php Style.css Replace Template: twentyseventeen with the name of your parent theme (it will be the folder name): function.php If you notice the… Read More