Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress Build a Website with WordPress Customizing WordPress Themes Customizing WordPress Theme Files

Saikat Chowdhury
Saikat Chowdhury
3,128 Points

WordPress child theme css changes does not effect my site. Could you please help ?

I have created a child folder allegiantchild which is a copy of allegiant. In allegiantchild folder has 3 files - index.php / style.css/function.php .

I am tring to update the footer color and when I updated footer color in allegiantchild /style.css file . It is still taking old color. Then I add function.php but still it is taking old color only

4 Answers

Saikat Chowdhury
Saikat Chowdhury
3,128 Points

Hi Arturo, Now my template is working fine , I am getting this error because in child style.css header , I missed to write Template: twentyfifteen

Thanks alot for your help. In future also required more help

Regards, Saikat

I think I found a solution to kind of the same problem. First check your functions.php in the child theme folder, and try to add only the following:

<?php
function my_theme_enqueue_styles() {

    $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>

Where parent-style is the same $handle used in the parent theme when it registers its stylesheet. For example, if the parent theme is twentyfifteen, by looking in its functions.php for its wp_enqueue_style() call, you can see the tag it uses there is 'twentyfifteen-style'.

You can find these instructions in https://codex.wordpress.org/Child_Themes

Second step, is to check your style.css in the child theme folder and add correctly the header as shown in the WP Codex

/*
 Theme Name:   Twenty Fifteen Child
 Theme URI:    http://example.com/twenty-fifteen-child/
 Description:  Twenty Fifteen Child Theme
 Author:       John Doe
 Author URI:   http://example.com
 Template:     twentyfifteen
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twenty-fifteen-child
*/

Change the example text above with your details relevant to the theme, specially put importance to Theme URI. Also here comes the trick, the Version number. Every time you change something to your child .css change the version in the text above to an increment or as you like. Changing this helps to enqueue correctly.

Everything is explained in the WP Codex link I mentioned above. Hope this helps, since it worked for me.

mop pom
mop pom
48 Points

Cant change css :( tried both solutions did not work. @2017

Saikat Chowdhury
Saikat Chowdhury
3,128 Points

Hi Mop, Could you please paste screen shot for Child theme and Parent Theme header. And one more thing , please check your child theme folder name.

Regards, Saikat