I've created a child theme of the twentyseventeen theme. In the child's theme folder I have a "style.css" and a "functions.php" file. Inside of the style.css file I have:
/*
Theme Name: Personal_theme
Theme URI: http://wordpress:8888/
Description: This is a child theme of twentyseventeen
Author: My name
Author URI: ...
Template: twentyseventeen
Version: 0.1;
*/
.entry-title {
color: blue;
}
and inside of functions.php:
<?php
function my_theme_enqueue_styles() {
$parent_style = 'parent-style';
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' );
?>
If I add "!important!" to the style, it works, it turns blue. If I use the inspector tool, I can see that the child stylesheet is being loaded after the parent, but the style is overwritten by the parent. I'm new to Wordpresss, is any of the parameter's in the functions.php wrong? Something I have to change?
$parent_style = 'parent-style';
be$parent_style = 'twentyseventeen-style';
? From the documentationFor example, if the parent theme is twentyfifteen, by looking in its functions.php for its wp_enqueue_style() call, you can see the tag it uses there is 'twentyfifteen-style'.
codex.wordpress.org/Child_Themes – MitchBroadhead