How can I make all the css in the twentyseventeen theme appear inline? I already tried putting the following in header.php:

    <?php include("/wp-content/themes/twentyseventeen/style.css");?>

and it did not work.

  • try simply 'style.css', as both are in the same folder
    – inarilo
    Aug 16, 2017 at 4:50
  • I created a child theme of it, but I still use style.css from twenty seventeen. Aug 16, 2017 at 12:05
  • 1
    why do you want it inline? this talks about the correct way to enqueue parent and child themes developer.wordpress.org/themes/advanced-topics/child-themes. alternatively try '../twentyseventeen/style.css'since both folders are under the same themes folder
    – inarilo
    Aug 17, 2017 at 11:37
  • Inline is supposed to be faster. Aug 17, 2017 at 15:49
  • Inlining "critical css" is faster, but probably not the entire stylesheet in the header. I'd recommend just putting the header/nav and critical css elements in there and take them out of the child css. I do hope you're working on a child of the theme and not the theme itself? If not, your changes will get removed every time you update. Aug 20, 2017 at 10:54

3 Answers 3


For some reason, taking out the beginning / solved my issue:

    <?php include("wp-content/themes/twentyseventeen/style.css");?>

After doing this, I removed it because I realized how much slower it made the page load.

  • this might actually work, but you should never include with relative paths. Sep 8, 2017 at 15:59

If you want to make it inline:

        <?php $css_file = file_get_contents( 'http://yoursite.com/wp-content/themes/twentyseventeen/style.css' );
        echo '<style type="text/css">' . $css_file . '</style>';

Use wp_register_style()

// Include stylesheets
function stylename() {
    wp_register_style( 'stylename', '/wp-content/themes/twentyseventeen/style.css' );
    wp_enqueue_style( 'stylename' );
add_action( 'wp_enqueue_scripts', 'stylename' );
  • 5
    hmmm that is not inline Aug 16, 2017 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.