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

Lisa Wagner
PLUS
Lisa Wagner
Courses Plus Student 13,702 Points

Building a WordPress Theme with Foundation 5 Workshop Question

Is it possible to get a download of the final theme php files for the workshop to examine?

I have WAMP running as a local host with wordpress and am having difficulty getting the php function to load the foundation styles into the site. So far the only way I'm able to link the css is via ""<link rel=etc"" in the header.php. Here is what is in functions.php:

'''<?php

// Load Foundation CSS

function foundation_styles() { wp_enqueue_style( 'foundation', get_template_directory_uri() . '/css/foundation.css' ); } add_action( 'wp-enqueue_scripts', 'foundation_styles' ); ?> '''

The header.php contains the code "<?php wp_head(); ?>", yet when I open up the site in the browser to check it, the css styles have not loaded. What am I missing?

2 Answers

Jon W
Jon W
6,185 Points

That's odd. The code in your functions.php file looks correct to me. Do you have any other actions/hooks in there and are they also working?

A bit obvious, but is foundation.css definitely in the /css subfolder and not the root?

You might want to use get_stylesheet_directory_uri() instead. Also are you using a child theme?

Lisa Wagner
PLUS
Lisa Wagner
Courses Plus Student 13,702 Points

Hi Jon,

Thank you for checking over the code and for your suggestions. The workshop is about taking a website based on the foundation framework and converting it into an actual wordpress theme. So there is no child theme. The theme /css subfolder does contain the foundation.css file. I'll try using get_stylesheet_directory_uri() as you suggested and hopefully that will work.

Thanks!