1
votes

really hoping someone can please help me! I just updated the Divi parent theme on my Wordpress site (www.ellymacdonalddesign.com), and the child CSS theme seems to have stopped working.

I've tried the solutions from this question, but they do not seem to work for me: Wordpress child theme style.css not working

My child functions.php file is currently:

<?php
function my_theme_enqueue_styles() {
    $parent_style = 'divi-style'; 
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( $child-style, get_stylesheet_uri() );
}
?>

Would really appreciate any guidance please, thank you in advance, Elly

2
I see the function, but you're not calling it anywhere. Do you have an add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); before or after that function?disinfor
Thanks so much for the reply. No I literally have no idea what I'm doing with the functions.php code (I've taught myself the stylesheet.css code, but have not had a chance to learn the .php stuff) - so should it be?: <?php add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); function my_theme_enqueue_styles() { $parent_style = 'divi-style'; wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( $child-style, get_stylesheet_uri() ); } ?>EllyM
Yes. You should just add the line I posted directly above your function. That should work.disinfor
Hi - thank you for the help, much appreciated. I've added that code into the functions.php file but the Child theme is still not working. So am thinking there must be some other problem. I think I might try deleting the Child theme and then reinstating it, hopefully that may work. Thank you again.EllyM

2 Answers

0
votes

Is your variable $child-style have any value? According to document, the handle name (first parameter) is required. That's why your child theme still not working.

Try below code to see if it's work:

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
    $parent_style = 'divi-style'; 
    $child_style = 'divi-style-child'; 
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( $child_style, get_stylesheet_uri() );
}
0
votes

Changing the css child theme version number helped solve the problem on my website.

My child theme was working correctly until I decided to change some css rules in the style.css file from the Wordpress 'Theme Editor' interface. I remarked that no changes appeared on the website, although the css was obviously loaded in the header and also I purged all cache.
I tried solutions of the following question but I think this is for new child theme installation, not an already working one: Wordpress child theme style.css not working

I decided to change the version number of my child theme, and the modifications were finally taken into account.

/*
 Theme Name:   Chromatic-child
 Template:     chromatic
 Version:      1.1.0
*/