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


Strange filepath issue when using get_template_directory

I am trying to follow along with the "Building a WordPress Theme with Foundation 5" workshop. When I tried to enqueue some stylesheets like I've done many times before I ran into a bug I've never encountered before

Here is my code in the functions.php file.

function foundation_styles() {
    wp_enqueue_style( 'foundation', get_template_directory() . '/css/foundation.css' );

add_action( 'wp_enqueue_scripts', 'foundation_styles' );

When viewing page source this is the file path that was enqueued: http://localhost/FoundationwebsiteC:xampphtdocsFoundationwebsite/wp-content/themes/foundation/css/foundation.css?ver=4.0

Instead it should be:


Notice the C:xampphtdocsFoundationwebsite/ hidden in the middle of the file path.

The exact same thing happened when I used get_stylesheet_directory() instead of get_template_directory()

The filepath for my local install is:


Anyone know what is causing my filepath to be so funky?

1 Answer

Thanks! Worked perfect!