0

I created a custom theme (style.css in the dashboard)

/*
Theme Name:     Client customisations
Description:    Child theme for the client Website
Author:         Me
Author URI:     http://example.com/about/
Template:       aries
Version:        1.0.0
*/

@import url("../aries/style.css");

h2{
    color: #4E8B4E !important;
    font-size: 1.4em;
}   

When I visit the front page in Chrome, I see that wp-content/themes/aries was loaded, but not my custom theme that is currently activated. What could be causing this issue?

  • You may need to enqueue the CSS as well. – Jono Warren Aug 27 '12 at 8:19
  • @Jono: So it isn't loaded automatically? – Casebash Aug 27 '12 at 8:23
  • I thought it was, but I'm guessing in your case it hasn't been, have you viewed the source of the page to see if you CSS is in the head? – Jono Warren Aug 27 '12 at 8:44
  • @Jono: It isn't – Casebash Aug 27 '12 at 12:43
2

I simply had to replace get_template_directory_uri() with get_stylesheet_directory_uri() in the parent template. I tried enqueing the css first, as I didn't want to modify the parent, but I couldn't get it working.

  • 1
    Actually, if you're referring to the primary stylesheet link, you should be using get_stylesheet_uri(). – Chip Bennett Aug 27 '12 at 13:39
  • In which file was this string found? – Kyle Jan 10 '13 at 9:20
0

For future people, I found this thread and followed Casebash's advice:

Find the child-theme's functions.php and replace get_template_directory_uri() on the parent-style with get_stylesheet_directory_uri() so it looks like the following:

function theme_enqueue_styles() {
    wp_enqueue_style('parent-style', get_stylesheet_directory_uri() . '/style.css');
    wp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css', array($parent_style));
}

This worked for me immediately. I hope it helps someone else.

  • Can you contribute what the correct solution would be? – Ali Jan 13 '17 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.