Puddinq.com sharing knowledge

Enqueue child style after parent style

Enqueue child style after parent style

There are a number of possibilities for adding the child theme styles after the parent style sheet so you can overrule parent styles from the child theme. this one is easy, copy the code to your functions.php and it will work.

// enqueue
function kjo_load_scripts($hook)
{

    // enqueue parent styles
    wp_enqueue_style('parent-theme', get_template_directory_uri() .'/style.css');

    // enqueue child styles
    wp_enqueue_style('child-theme', get_stylesheet_directory_uri() .'/style.css', array('parent-theme'));

}

add_action('wp_enqueue_scripts', 'kjo_load_scripts');