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() . 'https://cdn.isaac.io/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

Bulletproof / Simple Contact Form

I just need a simple contact form that always works. Less code the better. No bells or whistles. If spam becomes an issue, I can add a Google reCAPTCHA. Contact Form Code:

Installing Roots Trellis / Bedrock / Sage

Not sure how I feel about Roots.io –> The tutorials seem super easy, but I noticed you can quickly run into issues. What doesn’t help is that I can’t really find any reviews / user tutorials past 2016, the Roots discourse forum appears to be a bubble (not accepting new or differing ideas), and I… Read More