Custom CSS file???

Community Forums Forums Design Tips and Tricks Custom CSS file???

This topic is: not resolved

This topic contains 6 replies, has 3 voices, and was last updated by  Peter 1 year, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #19702

    chantal2012
    Participant
    Post count: 53

    I’ve been working with Thesis lots lately but am switching back to Genesis.  Working with Thesis, I got used to using the custom.css file which made it quicker to make changes and view them rather than searching through the style.css file.  Do child themes have a custom.css file, am I missing something?  If not, is there a quick way to implement one?

    #19712

    Peter
    Participant
    Post count: 76

    I’d say the child theme style.css is the custom CSS file really.. but if you wanted a separate physical custom.css file it’s probably easiest to either enqueue it in the child theme functions.php file or use one of the custom CSS plugins.


    Website: petercoughlin.com
    Twitter: petercoughlin

    #19715

    chantal2012
    Participant
    Post count: 53

    Anyone know what PHP code I would have to use to integrate a custom.css file?  I would like to have it set up so that anything that I modify in the custom.css file to overwrite anything in the style.css file.

    #19717

    Peter
    Participant
    Post count: 76

    This code will pull in a custom.css file from the child theme folder;

    add_action( 'wp_enqueue_scripts', 'enqueue_custom_stylesheet' );
    function enqueue_custom_stylesheet() {
    wp_register_style( 'custom-css', get_stylesheet_directory_uri() . '/custom.css' );
    wp_enqueue_style( 'custom-css' );
    }

    The custom.css file will be pulled in after the style.css file so your custom CSS code will overwrite any default CSS code.


    Website: petercoughlin.com
    Twitter: petercoughlin

    #19725

    RonnyMac
    Participant
    Post count: 61

    There are plenty of schools of thought and multiple ‘best practices’ regarding CSS files. For some sites I’ll edit the style.css file directly. For others, especially those with minimal edit requirements, I’ll create a separate custom.css file and leave the original style.css file alone. My overall preference is to have a single style.css file, so sometimes I’ll simply add edits to the bottom of the original style.css file.

    All that matters, though, is what fits best in your work environment and work flow.


    #19803

    chantal2012
    Participant
    Post count: 53

    So where would I put this PHP Code exactly?  So assuming that I create a custom.css file, and put in this PHP code, I will be able to add css code to the custom.css file and this will overwrite what is on the style.css sheet?

    #19804

    Peter
    Participant
    Post count: 76

    You would add that PHP code to your child theme functions.php file, and then put a custom.css file in your child theme folder.

    It might be worth you having a read through the tutorials page to get a little more familiar with Genesis child themes.. there’s lots of good info in them;

    http://my.studiopress.com/tutorials/


    Website: petercoughlin.com
    Twitter: petercoughlin

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.