I hope you can help. I have created a child theme for my wordpress page and set up the style.css and functions.php in it. I assume the enqueue has been set up correctly as I can change a few different things and it appears successfully. However if I try to change something which is in the index.php it doesn't overwrite.
For example I am trying to change the colour of the links when hovered over.
I have checked through various other posts and documentation but doesn't seem to have helped.
Any suggestions or confirmation if my enqueue is infact correct would be gratefully received.
This is my style.css
/* Theme Name: Blossom pin child
Theme URI: https://www.diagnosischerry.co.uk
Description: A blossom pin child theme
Author: Blossom Themes
Author URI: https://blossomthemes.com/
Template: blossom-pin
Version: 1.0.0
Text Domain: blossom-pin-child
*/
.archive #primary .post .entry-header .category a {
background: red!important;
}
.archive #primary .post .entry-header .category a:hover {
background: red!important;
}
and this is my functions.php
<?php
// enqueue parent styles
function blossompin_scripts() {
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
wp_enqueue_style('child-style', get_stylesheet_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', blossompin_scripts);
?>
EDIT: The enqueueing does seem to be correct as I am able to update the background of the text and some other text but I am having trouble pinpointing and changing the colour of the background colour of a category link.
Below is the pink background I am referring to
The above picture is of inspect. If I change the colour on the top bit from pink it changes but if I were to copy all of that and put it in my style.css or just take the section I think it relates to then it doesn't change colour, just remains pink.
Many thanks Ray
You used
get_stylesheet_uri()
function wrongly and not CSS related problem. If you check the definition ofget_stylesheet_uri()
function, you can see it returns full URL of the style.css file in child theme directorySo to enqueue style.css in child theme, you should use
wp_enqueue_style('child-style', get_stylesheet_uri());
orwp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css');