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 Loop - content not appearing

Websites > How to Build a WordPress Theme > WordPress Theme Functions > The WordPress Loop

Copied all the code into the front-page.php and home.php. Refresh the page and all that's there is -

This is the header

This is the front-page.php file

This is the footer

I'm sure I have followed everything to the letter and the loop is not getting seen.

How can I debug this?

4 Answers

Matt Campbell
Matt Campbell
9,767 Points

What have you written for the loop and have you actually got any posts?

I get the same.

<?php get_header(); ?>

<p>this is the frontpage</p>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php endwhile; else: ?>

<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<hr>

<?php endif; ?>

<p>there are no posts to show</p>

<?php get_footer(); ?>

is my code

this is the video http://teamtreehouse.com/library/websites/how-to-build-a-wordpress-theme/wordpress-theme-functions/the-wordpress-loop

Gareth Edwards
Gareth Edwards
7,243 Points

Did you guys manage to sort this out? I'm in the same position now.