Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,687 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,950 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.