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

Catherine Millington
Catherine Millington
3,754 Points

My default.css won't work in my child theme for Fifteen (css/skins). I have added code enqueue it into functions.php.

I want to change the transparent black hovers and backgrounds on the headings. It looks like it is in the default.css. I have copies across the folder structure and made a new default.css but the changes don't seem to work. I think its this code;

.single .single-entry-title,
.page .single-entry-title,
.search .single-entry-title,
.archive .single-entry-title {
  background: rgba(178, 178, 178, 0.6);
  padding: 25px 30px;
  margin-bottom: -55px;
  color: #eee;
  font-weight: lighter;
  margin-top: 30px;
}

I have changed the .less file too just in case.

Hi Catherine,

Can you post your functions enqueue script too please?

Thanks

-Rich

(Oh and I've just updated your question slightly to include markdown. It just makes the code a little easier to read that's all. This post will explain how to do it if you need to in future :) )

Catherine Millington
Catherine Millington
3,754 Points

Hi Rich, thanks for offering help on this.

<?php 

function theme_name_scripts() {
    wp_enqueue_style( 'default', get_stylesheet_uri() );
    wp_enqueue_script( 'default', get_template_directory_uri() .'wp-content/themes/fifteenchild/css/skins/default.css' , array(), '1.0.0', true );
}

add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );

I don't really understand the code if i'm honest so have started the theme development course to try and get my head round the functions.

1 Answer

Hi Catherine,

The WordPress Codex has a great breakdown of the how to create a child theme and explains it really well but if you're looking to have it completely custom I'd recommend looking at the theme development course as you mentioned.

Try this from the 'How to Create a Child Theme' section though:

function theme_enqueue_styles() {

    $parent_style = 'parent-style';

    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 )
    );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );

Is there a reason you've named the stylesheet default.css? If not, I'd probably call it style.css and include the details from the link above.

If you need both you could simply add another line to the code above:

wp_enqueue_style( 'child-style-default', get_stylesheet_directory_uri() . '/default.css', array( $parent_style ) );

Hope that helps in some way :)

-Rich