Child Themes of Non-WordPress Sanctioned Templates

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.

Read More

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?

Related posts

1 comment

  1. Use get_stylesheet_directory_uri() and get_stylesheet_directory() for Child Themes

    Use get_template_directory_uri() and get_template_directory() for Parent Themes

    Thus making your function:

    <?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_stylesheet_directory_uri(); ?>/css/custom.css"/> 
    <?php  } else {?>
         <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/light.css"/> 
    <?php  } ?>
    

    …subtle difference which can be easy to miss.

    Helpful resources:

Comments are closed.