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 trialSERGIO RODRIGUEZ
17,532 Points[SOLVED] My site currently has 0 pages and 0 posts. Why am I not seeing the "Sorry, but you are ..." message?
I am following along the videos and I tested the loop to see how the else statement behaves by deleting all post and pages from my site.
Surprisingly, I get a blank page with no fallback/error message.
The code I'm using is:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<p><?php the_content(); ?></p>
<?php endwhile; else : ?>
<p><?php _e( 'Sorry, no results found.', 'treehouse-portfolio' ); ?></p>
<?php endif; ?>
[SOLVED] It was my mistake, at this point in the course you should only have the index.php template available. I had all the templates from the finished project files in the theme folder.
1 Answer
justinw
14,517 PointsHi SERGIO RODRIGUEZ this is a great reminder to not pull the resources from final lessons and to progress with the video at hand. Happy to hear you solved this, keep learning and coding!