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

Colin Stodd
Colin Stodd
6,257 Points

Not seeing post when clicking on the post from blog home.php

When on the blog home page (posts) page/home.php -> and I click on a post, it is taking me to another template that I've created and It's not displaying the actual post.

1 Answer

Colin Stodd
Colin Stodd
6,257 Points

I found the answer, I needed to wrap the loop

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

/* Content here */

<?php endwhile; else : ?>
    <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>

Around all of my dynamic content (I think thats the correct term).

Sue Dough
Sue Dough
35,800 Points

Hey Colin,

One thing to keep in mind is if your using _e to translate it is important to add a second paramater with the language domain. It could be the name of the plugin or theme.

<p><?php _e( 'Sorry, no posts matched your criteria.', 'your_language_name' ); ?></p>