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.

Kent Åsvang
18,822 PointsI is actually necessary to include the if-statement in the wordpress-loop?
Shouldn't it be sufficient to use the condition in the while loop? To me it seems redundant to first check have_posts(), and then let the while loop run as long as it is true. I'd be grateful if anyone could provide some clarity as to why we do it this way.
1 Answer

Joe Klovance
3,275 PointsIn some cases there may need to be processing before or after the posts are processed. This processing may not need to be done if there are no posts. For example, you may want to alert about new posts. This does not need to happen if there are no posts.
Kent Åsvang
18,822 PointsKent Åsvang
18,822 PointsOf course. Thanks for clarifying. I probably should have figured out this myself.