Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.