I have created and used over a dozen WordPress child themes for various websites. I have downloaded the themes from WordPress. This time I wanted to use a theme outside of WordPress’ realm. I heard good things about Gridly, actually it was part of Lynda.com’s presentation.
When I tried to create a child theme for Gridly, I approached it in the same manner. I set up the usual directory and css files with the correct info at
the top. I imported all the original theme’s style.css. I activated my new child theme.
Despite all of that I still can’t use custom CSS. In fact, when I use Chromes Dev tools and inspect where an element is getting its styling from, it comes from the parent theme’s stylesheets. When I inspect the header it calls for
<?php if ($gridly_color_scheme == 'dark') { ?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ? >/css/dark.css" />
<?php } elseif ($gridly_color_scheme == 'custom') { ?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/custom.css"/>
<?php } else {?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/light.css"/>
<?php } ?>
I have don’t know if that get_template_directory_uri();
is getting the parent or child theme’s uri.
Can anyone shed any light on this?
Use
get_stylesheet_directory_uri()
andget_stylesheet_directory()
for Child ThemesUse
get_template_directory_uri()
andget_template_directory()
for Parent ThemesThus making your function:
…subtle difference which can be easy to miss.
Helpful resources: