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 Working with CSS and JS in WordPress Themes How to Link to JS from functions.php File

Craig Jamieson
Craig Jamieson
19,585 Points

cannot get css and js to load into header. php

Hi

I have followed the tutorials to get the css and js of my theme into the functions.php file, included the add code and in the header.php have the wp_head code, but it is not linking into my site when I test.

Functions Code

//Load the Theme CSS
function cj_theme_styles() {

wp_enqueue_style( 'normalize_css', get_template_directory_uri() . '/css/normalize.css' );
wp_enqueue_style( 'font_css', 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400,600' );
wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );

}

add_action( 'wp_enqueue_scripts', 'cj_theme_styles' );

function cj_theme_js () {

wp_enqueue_script('modernizr_js', get_template_directory_uri() . '/css/modernizr.js', '', '', 'false' );

}

add_action( 'wp_enqueue_scripts', 'cj_theme_js' );

/* Disable the Admin Bar. */
add_filter( 'show_admin_bar', '__return_false' );
Craig Jamieson
Craig Jamieson
19,585 Points

I removed a plugin and it seems to be working now. Thanks :)

Ian Mackenzie
Ian Mackenzie
11,062 Points

Hi Craig,

I'm having the same problem, which plugin did you remove?