Thanks for your feedback.
It seems that it’s working fine.
If you want to call the same style element of the parent style in the child theme’s stylesheet then you must override it, otherwise it should be working fine.
Thread Starter
mr108
(@mr108)
I double checked and it does not work.
Yes, I know that I have to overwrite the parent’s styles in the child theme. But the problem is in your functions.php file – this does not work:
<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
BUT this works OK:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array('parent-style')
);
}
Is it clear now?
Thread Starter
mr108
(@mr108)
or you can use this one that comes from
https://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme
<?php
function my_theme_enqueue_styles() {
$parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>
Thanks for notifying the bug