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

Can't seem to get the CSS to port into functions.php | Any advice at what i'm doing wrong?

I'm trying to import my CSS into my WordPress theme. I've followed the instructions on the video but for some reason, it won't load. The JavaScript seems to be working fine. Can anyone see where I'm going wrong?

This is my functions.php file

<?php

function kadg_theme_styles()
{
wp_enqueue_styles('main_css', get_template_directory_uri() . '/style.css');
wp_enqueue_styles('noscript_css', get_template_directory_uri() . '/assets/css/noscript.css');
wp_enqueue_styles('fa_min_css', get_template_directory_uri() . '/assets/css/font-awesome-min.css');
}

add_action('wp_enqueue_styles' , 'kadg_theme_styles');

?>

<?php

function kadg_theme_js()
{
wp_enqueue_scripts('skel_min_js', get_template_directory_uri() . '/assets/js/skel.min.js' , '' , '' , true);
wp_enqueue_scripts('main_js', get_template_directory_uri() . '/assets/js/main.js' , '' , '' , true);
}

add_action('wp_enqueue_scripts','kadg_theme_js');
?>

This is my header.php file

<!DOCTYPE HTML>
<html>
<head>
<title><?php bloginfo('name');?></title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<? wp_head();?>
</head>

This is my footer.php file

<!-- Copyright -->
<div class="copyright">&copy; <?php echo date('Y');?> | The Kick Ass Donkey Group Limited </div>

</div>

</div>

<?php wp_footer();?>

</body>
</html>

This is my index.php file

<?php get_header();?>

<body>

<!-- Page Wrapper -->
<div id="page-wrapper">

<!-- Wrapper -->
<div id="wrapper">

<!-- Panel (Banner) -->
<section class="panel banner right">
<div class="content color0 span-3-75">
    <h1 class="major"><a href="<?php bloginfo('url')?>"><?php bloginfo('name');?></a></h1>
<p>This is my website</p>
<ul class="actions">
<li><a href="#first" class="button special color1 circle icon fa-angle-right">Next</a></li>
</ul>
</div>
<div class="image filtered span-1-75" data-position="25% 25%">
<img src="images/pic01.jpg" alt="" />
</div>
</section>

<!-- Panel (Spotlight) -->
<section class="panel spotlight medium right" id="first">
<div class="content span-7">
<h2 class="major">Sed etiam aenean</h2>
<p>Mauris et ligula arcu. Proin dapibus convallis accumsan. Lorem maximus hendrerit orci, sit amet elementum massa hendrerit sed. Donec et ullamcorper ligula. Suspendisse amet potenti. Ut pretium libero eleifend euismod sed tristique. Quisque dictum magna risus, id ultricies justo sagittis vitae. Sed id odio tempor, porttitor elit amet, gravida hendrerit fringilla lorem ipsum dolor.</p>
</div>
<div class="image filtered tinted" data-position="top left">
<img src="images/pic02.jpg" alt="" />
</div>
</section>

<!-- Panel -->
<section class="panel color1">
<div class="intro joined">
<h2 class="major">Amet lorem</h2>
<p>Sed vel nibh libero. Mauris et lorem pharetra massa lorem turpis congue pulvinar. Vivamus sed feugiat finibus. Duis amet bibendum amet sed. Duis mauris ex, dapibus sed ligula tempus volutpat magna etiam.</p>
</div>
<div class="inner">
<ul class="grid-icons three connected">
<li><span class="icon fa-diamond"><span class="label">Lorem</span></span></li>
<li><span class="icon fa-camera-retro"><span class="label">Ipsum</span></span></li>
<li><span class="icon fa-cog"><span class="label">Dolor</span></span></li>
<li><span class="icon fa-paper-plane"><span class="label">Sit</span></span></li>
<li><span class="icon fa-bar-chart"><span class="label">Amet</span></span></li>
<li><span class="icon fa-code"><span class="label">Nullam</span></span></li>
</ul>
</div>
</section>

<!-- Panel (Spotlight) -->
<section class="panel spotlight large left">
<div class="content span-5">
<h2 class="major">Magna amet tempus</h2>
<p>Mauris a cursus velit. Nunc lacinia sollicitudin egestas bibendum, magna dui bibendum ex, sagittis commodo enim risus sed magna nulla. Vestibulum ut consequat velit. Curabitur vitae libero lorem. Quisque iaculis porttitor blandit. Nullam quis sagittis maximus. Sed vel nibh libero. Mauris et lorem pharetra massa lorem turpis congue pulvinar.</p>
</div>
<div class="image filtered tinted" data-position="top right">
<img src="images/pic03.jpg" alt="" />
</div>
</section>

<!-- Panel -->
<section class="panel">
<div class="intro color2">
<h2 class="major">Elit integer</h2>
<p>Sed vel nibh libero. Mauris et lorem pharetra massa lorem turpis congue pulvinar. Vivamus sed feugiat finibus. Duis amet bibendum amet sed. Duis mauris ex, dapibus sed ligula tempus volutpat magna etiam.</p>
</div>
<div class="gallery">
<div class="group span-3">
<a href="images/gallery/fulls/01.jpg" class="image filtered span-3" data-position="bottom"><img src="images/gallery/thumbs/01.jpg" alt="" /></a>
<a href="images/gallery/fulls/02.jpg" class="image filtered span-1-5" data-position="center"><img src="images/gallery/thumbs/02.jpg" alt="" /></a>
<a href="images/gallery/fulls/03.jpg" class="image filtered span-1-5" data-position="bottom"><img src="images/gallery/thumbs/03.jpg" alt="" /></a>
</div>
<a href="images/gallery/fulls/04.jpg" class="image filtered span-2-5" data-position="top"><img src="images/gallery/thumbs/04.jpg" alt="" /></a>
<div class="group span-4-5">
<a href="images/gallery/fulls/05.jpg" class="image filtered span-3" data-position="top"><img src="images/gallery/thumbs/05.jpg" alt="" /></a>
<a href="images/gallery/fulls/06.jpg" class="image filtered span-1-5" data-position="center"><img src="images/gallery/thumbs/06.jpg" alt="" /></a>
<a href="images/gallery/fulls/07.jpg" class="image filtered span-1-5" data-position="bottom"><img src="images/gallery/thumbs/07.jpg" alt="" /></a>
<a href="images/gallery/fulls/08.jpg" class="image filtered span-3" data-position="top"><img src="images/gallery/thumbs/08.jpg" alt="" /></a>
</div>
<a href="images/gallery/fulls/09.jpg" class="image filtered span-2-5" data-position="right"><img src="images/gallery/thumbs/09.jpg" alt="" /></a>
</div>
</section>

<!-- Panel -->
<section class="panel color4-alt">
<div class="intro color4">
<h2 class="major">Contact</h2>
<p>Sed vel nibh libero. Mauris et lorem pharetra massa lorem turpis congue pulvinar. Vivamus sed feugiat finibus. Duis amet bibendum amet sed. Duis mauris ex, dapibus sed ligula tempus volutpat magna etiam.</p>
</div>
<div class="inner columns divided">
<div class="span-3-25">
<form method="post" action="#">
<div class="field half">
<label for="name">Name</label>
<input type="text" name="name" id="name" />
</div>
<div class="field half">
<label for="email">Email</label>
<input type="email" name="email" id="email" />
</div>
<div class="field">
<label for="message">Message</label>
<textarea name="message" id="message" rows="4"></textarea>
</div>
<ul class="actions">
<li><input type="submit" value="Send Message" class="button special" /></li>
</ul>
</form>
</div>
<div class="span-1-5">
<ul class="contact-icons color1">
<li class="icon fa-twitter"><a href="#">@untitled-tld</a></li>
<li class="icon fa-facebook"><a href="#">facebook.com/untitled</a></li>
<li class="icon fa-snapchat-ghost"><a href="#">@untitled-tld</a></li>
<li class="icon fa-instagram"><a href="#">@untitled-tld</a></li>
<li class="icon fa-medium"><a href="#">medium.com/untitled</a></li>
</ul>
</div>
</div>
</section>

<!-- Panel -->
<section class="panel color2-alt">
<div class="intro color2">
<h2 class="major">Elements</h2>
<p>Sed vel nibh libero. Mauris et lorem pharetra massa lorem turpis congue pulvinar. Vivamus sed feugiat finibus. Duis amet bibendum amet sed. Duis mauris ex, dapibus sed ligula tempus volutpat magna etiam. </p>
</div>
<div class="inner columns aligned">
<div class="span-2-75">

<h3 class="major">Text</h3>
<p>This is <b>bold</b> and this is <strong>strong</strong>. This is <i>italic</i> and this is <em>emphasized</em>.
This is <sup>superscript</sup> text and this is <sub>subscript</sub> text.
This is <u>underlined</u> and this is code: <code>for (;;) { ... }</code>. Finally, <a href="#">this is a link</a>.</p>

<h1>Heading Level 1</h1>
<h2>Heading Level 2</h2>
<h3>Heading Level 3</h3>
<h4>Heading Level 4</h4>
<h5>Heading Level 5</h5>
<h6>Heading Level 6</h6>

</div>
<div class="span-3">

<h4>Blockquote</h4>
<blockquote>Lorem ipsum dolor sit amet. Felis sagittis eget tempus euismod. Vestibulum ante ipsum primis in vestibulum. Blandit adipiscing eu iaculis volutpat ac adipiscing volutpat ac adipiscing faucibus.</blockquote>

<h4>Preformatted</h4>
<pre><code>i = 0;

while (!deck.isInOrder()) {
print 'Iteration ' + (i++);
deck.shuffle();
}

print 'It took ' + i + ' iterations to sort the deck.';</code></pre>

</div>
<div class="span-1-25">

<h3 class="major">Lists</h3>

<h4>Unordered</h4>
<ul>
<li>Lorem ipsum dolor sit.</li>
<li>Dolor pulvinar etiam.</li>
<li>Etiam vel felis viverra.</li>
</ul>

<h4>Alternate</h4>
<ul class="alt">
<li>Lorem ipsum dolor sit.</li>
<li>Dolor pulvinar etiam.</li>
<li>Etiam vel felis viverra.</li>
<li>Felis enim feugiat.</li>
</ul>

</div>
<div class="span-1-5">

<h4>Ordered</h4>
<ol>
<li>Lorem ipsum dolor sit.</li>
<li>Dolor pulvinar etiam.</li>
<li>Etiam vel felis viverra.</li>
<li>Felis enim feugiat.</li>
<li>Etiam vel felis lorem.</li>
</ol>

<h4>Actions</h4>
<ul class="actions">
<li><a href="#" class="button special color2">Default</a></li>
<li><a href="#" class="button">Default</a></li>
</ul>
<ul class="actions vertical">
<li><a href="#" class="button special color2">Default</a></li>
<li><a href="#" class="button">Default</a></li>
</ul>

</div>
<div class="span-1-25">

<h4>Icons</h4>
<ul class="icons">
<li><a href="#" class="icon fa-twitter"><span class="label">Twitter</span></a></li>
<li><a href="#" class="icon fa-facebook"><span class="label">Facebook</span></a></li>
<li><a href="#" class="icon fa-instagram"><span class="label">Instagram</span></a></li>
<li><a href="#" class="icon fa-github"><span class="label">GitHub</span></a></li>
<li><a href="#" class="icon fa-medium"><span class="label">Medium</span></a></li>
</ul>

<h4>Contact Icons</h4>
<ul class="contact-icons color2">
<li class="icon fa-twitter"><a href="#">Twitter</a></li>
<li class="icon fa-facebook"><a href="#">Facebook</a></li>
<li class="icon fa-instagram"><a href="#">Instagram</a></li>
<li class="icon fa-github"><a href="#">GitHub</a></li>
<li class="icon fa-medium"><a href="#">Medium</a></li>
</ul>

</div>
<div class="span-3">
<h3 class="major">Table</h3>
<h4>Default</h4>
<div class="table-wrapper">
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Item One</td>
<td>Ante turpis integer aliquet porttitor.</td>
<td>29.99</td>
</tr>
<tr>
<td>Item Two</td>
<td>Vis ac commodo adipiscing arcu aliquet.</td>
<td>19.99</td>
</tr>
<tr>
<td>Item Three</td>
<td> Morbi faucibus arcu accumsan lorem.</td>
<td>29.99</td>
</tr>
<tr>
<td>Item Four</td>
<td>Vitae integer tempus condimentum.</td>
<td>19.99</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2"></td>
<td>100.00</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="span-3">
<h4>Alternate</h4>
<div class="table-wrapper">
<table class="alt">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Item One</td>
<td>Ante turpis integer aliquet porttitor.</td>
<td>29.99</td>
</tr>
<tr>
<td>Item Two</td>
<td>Vis ac commodo adipiscing arcu aliquet.</td>
<td>19.99</td>
</tr>
<tr>
<td>Item Three</td>
<td> Morbi faucibus arcu accumsan lorem.</td>
<td>29.99</td>
</tr>
<tr>
<td>Item Four</td>
<td>Vitae integer tempus condimentum.</td>
<td>19.99</td>
</tr>
<tr>
<td>Item Five</td>
<td>Ante turpis integer aliquet porttitor.</td>
<td>29.99</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2"></td>
<td>100.00</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="span-2-25">
<h3 class="major">Buttons</h3>
<ul class="actions">
<li><a href="#" class="button special color2">Special</a></li>
<li><a href="#" class="button">Default</a></li>
</ul>
<ul class="actions">
<li><a href="#" class="button">Default</a></li>
<li><a href="#" class="button large">Large</a></li>
<li><a href="#" class="button small">Small</a></li>
</ul>
<ul class="actions">
<li><a href="#" class="button special color2 icon fa-cog">Icon</a></li>
<li><a href="#" class="button icon fa-diamond">Icon</a></li>
</ul>
<ul class="actions">
<li><span class="button special color2 disabled">Disabled</span></li>
<li><span class="button disabled">Disabled</span></li>
</ul>
<ul class="actions">
<li><a href="#" class="button special color2 circle icon fa-cog">Icon</a></li>
<li><a href="#" class="button circle icon fa-diamond">Icon</a></li>
</ul>
</div>
<div class="span-4-5">
<h3 class="major">Form</h3>
<form method="post" action="#">
<div class="field third">
<label for="demo-name">Name</label>
<input type="text" name="demo-name" id="demo-name" value="" placeholder="Jane Doe" />
</div>
<div class="field third">
<label for="demo-email">Email</label>
<input type="email" name="demo-email" id="demo-email" value="" placeholder="jane@untitled.tld" />
</div>
<div class="field third">
<label for="demo-category">Category</label>
<div class="select-wrapper">
<select name="demo-category" id="demo-category">
<option value="">-</option>
<option value="1">Manufacturing</option>
<option value="1">Shipping</option>
<option value="1">Administration</option>
<option value="1">Human Resources</option>
</select>
</div>
</div>
<div class="field quarter">
<input type="radio" id="demo-priority-low" name="demo-priority" class="color2" checked />
<label for="demo-priority-low">Low Priority</label>
</div>
<div class="field quarter">
<input type="radio" id="demo-priority-high" name="demo-priority" class="color2" />
<label for="demo-priority-high">High Priority</label>
</div>
<div class="field quarter">
<input type="checkbox" id="demo-copy" name="demo-copy" class="color2" />
<label for="demo-copy">Email a copy</label>
</div>
<div class="field quarter">
<input type="checkbox" id="demo-human" name="demo-human" class="color2" checked />
<label for="demo-human">Not a robot</label>
</div>
<div class="field">
<label for="demo-message">Message</label>
<textarea name="demo-message" id="demo-message" placeholder="Enter your message" rows="2"></textarea>
</div>
<ul class="actions">
<li><input type="submit" value="Send Message" class="special color2" /></li>
<li><input type="reset" value="Reset" /></li>
</ul>
</form>
</div>
</div>
</section>
<?php get_footer();?>

3 Answers

Joel Bardsley
Joel Bardsley
31,249 Points

Your opening PHP tag in header.php isn't quite right ( <? wp_head();?> ) - fix this line and see if that helps.

I fixed the opening tag and it died. I don't know what's going on but I really don't think WordPress likes me too much. I don't remember PHP, HTML5 and CSS3 being this difficult for me to learn. I can't tell you how much it's driving me crazy. If I wasn't such a determined little sod I'd probably have given up by now. This is a long term battle for me. The WordPress developer who works with our company tells me that I should be able to pick it up with my knowledge of other code. I'm starting to think he has misplaced confidence.

Joel Bardsley
Joel Bardsley
31,249 Points

I've had another look through the rest of the code and can't spot anything obvious that might be causing the issue you're experiencing. I wouldn't get disheartened, it's probably something tiny that a little debugging will fix.

I've sent you an email via the website in your profile. Let me know if it doesn't reach you.

I'm hoping this issue has been resolved, but if not, I would look at this wp_enqueue_styles('main_css', get_template_directory_uri() . '/style.css'); and change the get_template_directory_uri() function to get_stylesheet_directory_uri(), this might help.

Thank you all for your support. I gave up trying to convert that particular static file after about 12 hours of it driving me insane. I've decided to re-approach the wp-theme development with a less complicated static site. I would like to say however, you've all been awesome. Plus a special thank you for Joel who was willing to give up his time and crawl through my code to fix the issue.