• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Add custom.css and or font with code or header link. Best practice?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Add custom.css and or font with code or header link. Best practice?

This topic is: resolved

Tagged: custom css

  • This topic has 4 replies, 2 voices, and was last updated 12 years, 3 months ago by dev.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • March 15, 2014 at 2:18 pm #95061
    dev
    Participant

    I know some folks say that a custom.css is not needed with Genesis child themes, but we use them anyway for reasons too involved to discuss here.

    We have always used the link in the Genesis Theme Options "header" box:

    <link rel='stylesheet' id='optimal-theme-css'  href='http://xxxxxx/custom.css?ver=1.0.0' type='text/css' media='all' />
    

    but I'm now seeing people suggesting we use code in functions.php like this:

    add_action( 'wp_enqueue_scripts', 'maj_load_custom_css' );
    function maj_load_custom_css() {
        wp_enqueue_style( 
            'custom-css', 
            CHILD_URL . '/custom.css', 
            array(), 
            PARENT_THEME_VERSION 
        );
    }
    

    Is one way any more efficient than the other? What is the 'best practice' now.

    Same kind of question for adding Google fonts. It used to be a link in 'header' and now its code? How come?

    Thanks.

    Dev

    March 16, 2014 at 8:27 am #95130
    Sridhar Katakam
    Participant

    I think enqueueing is the way to go whether it is custom css or Google fonts.


    Genesis Tutorials | Follow me on Twitter

    March 16, 2014 at 8:57 am #95140
    dev
    Participant

    Thanks, but can you give me some technical reason for why you think enqueueing is more efficient than the "link" method?

    Dev

    March 16, 2014 at 9:01 am #95144
    Sridhar Katakam
    Participant

    You may find the answer in http://code.tutsplus.com/articles/how-to-include-javascript-and-css-in-your-wordpress-themes-and-plugins--wp-24321. Scroll down to "So, Why Doesn't Everyone Already Do Things This Way?" section.


    Genesis Tutorials | Follow me on Twitter

    March 16, 2014 at 1:26 pm #95196
    dev
    Participant

    Thanks. The code method works fine for both .css and fonts. I'll do it this way from now on.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble