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 WordPress Theme Development WordPress Header and Footer Templates Porting existing headers and footers into WordPress

Christopher Brennan
Christopher Brennan
325 Points

My css is not loading

<?php

function fart_theme_styles() {
    wp_enqueue_style( 'foundation_css', get_template_directory_uri() . '/css/foundation.css' );
    wp_enqueue_style( 'normalize_css', get_template_directory_uri() . '/css/normalize.css' );
    wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );

}
add_action('wp_enqueue_scripts', 'fart_theme_styles');

?>
<!doctype html>
<html class="no-js" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title> <?php wp_title(); ?> </title>
    <?php wp_head(); ?>
    </head>

  <body>


  <?php get_header(); ?>
<p>fart</p>
  <?php get_footer(); ?>
Austin Whipple
Austin Whipple
29,725 Points

I modified your question a bit to format the code blocks. Be sure to check out the Markdown Cheatsheet link below the text editor for more information.

2 Answers

Shane Oliver
Shane Oliver
19,977 Points

I assume by 'my css...' you are referring to the style.css file. You can get the stylesheet for the theme using the following

wp_enqueue_style( 'style-name', get_stylesheet_uri() );

This will load the style.css file found in the theme root.

Christopher Brennan
Christopher Brennan
325 Points

This was brutal. I copied and paste wrong code. Doctype is supposed to go in the head. I had the correct code before, the problem was my functions.php file was singular not plural. grabs head 2hrs and I figured this out finally. functions.php, everyone! not function.php.