I think I managed by adding a functions.php file containing the following:
<?php
add_action( ‘wp_enqueue_scripts’, ‘enqueue_child_theme_styles’, PHP_INT_MAX);
function enqueue_child_theme_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ );
wp_enqueue_style( ‘child-style’, get_stylesheet_uri(), array(‘parent-style’) );
}
Can anyone confirm if this is the right thing to do please?
Is your child theme active now (11:23 am, Mountain time)? When I look at your site, everything seems to be in order. What specifically wasn’t working correctly when your child theme was active?
Hey,
Right now (11:23) it’s active. The theme looks ok since I created that functions.php file in my child directory (please see my second post) that’s why I was asking if I had done ok or not (since in some threads people worry about the fact that you create a functions.php file on your child directory).
Basically if I don’t include my functions.php the Child theme looks like a mess. Try visting my site now and you will see the difference… http://www.cupricagency.com
Thanks! Alexandra
Ok, I understand now. What you did in the second post is the recommended way of creating child themes.
What was happening with your child theme before was that you had this line commented out:
/*
@import url("../opulus-sombre/style.css");
*/
In CSS, everything between /* */
is ignored by the browser. The @import
line essentially does the same thing as what you did in the second post, but @import
is a bit slower.
So in conclusion, yes, you did everything correctly.
mmmm I didn’t change anything in the style.css the only thing I did is adding a functions.php file with the following text:
<?php
add_action( ‘wp_enqueue_scripts’, ‘enqueue_child_theme_styles’, PHP_INT_MAX);
function enqueue_child_theme_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ );
wp_enqueue_style( ‘child-style’, get_stylesheet_uri(), array(‘parent-style’) );
}
I probably wasn’t clear with my last message. You should add your functions.php
back to your child theme and continue to do what you were doing before.