I’m using the HashOne theme and created a child theme in order to make various color changes to our website.

However, the changes I’ve made to the child theme stylesheet are only taking place in the certain sections of the site, while other changes are deferring to the parent theme. I created a functions.php file that I believe is properly formatted. See below:

<?php
add_action( 'wp_enqueue_scripts', 'hashone_enqueue_styles' );
function hashone_enqueue_styles() {
wp_enqueue_style( 'hashone-parent-style', get_template_directory_uri() . 
'/style.css' );
}

When I used the inspect mode to see which CSS was overriding the child theme, I was able to confirm that it is definitely the parent theme. However, there are three CSS files operating at once and I have no idea how to rectify this.

  1. stage.ottrial.pitt.edu/wp-content/themes/hashone/style.css?ver=4.7.1
  2. stage.ottrial.pitt.edu/wp-content/themes/hashone-theme-child/style.css?ver=1.0
  3. stage.ottrial.pitt.edu/wp-content/themes/hashone/style.css

The one that’s leading the pack is #3. I’m not sure what I’m doing wrong here.

3 s
3

There’s no need for more code in your functions.php file to enqueue the parent themes css from your child theme. The problem is that by adding that code, you’re enqueueing the parent theme’s CSS a second time, but it’s now loading after the child theme. This means that all the changes you made in the child theme will have no effect.

Simply remove that line and you should see the changes in your child theme.

Added:
Here are the two files I used with only the basics to properly enqueue the child theme css.

style.css file:

/*
 * Theme Name: HashOne Child
 * Template: hashone
 * Text Domain: hashone-chile
 */

functions.php file:

<?php
add_action( 'wp_enqueue_scripts', function() {
  wp_enqueue_style( 'hashone-parent-style', get_template_directory_uri() . '/style.css' );
});

Leave a Reply

Your email address will not be published. Required fields are marked *