Re:A solution for designers who don't know Wordpress
by sopooneo on Thursday May 09, 2013 @03:42PM
(#5682502)
Why do you need the if? Shouldn't the while loop run zero times if have_posts() returns NULL or an empty array?
[ Parent
| on HN ]
Re:A solution for designers who don't know Wordpress
by vec on Thursday May 09, 2013 @04:42PM
(#5682827)
It's idiomatic to use the if so you can do this
<?php if (have_posts()) : while (have_posts()) : the_post() ?>
<!-- do loop stuff -->
<?php endwhile; else : ?>
<!-- no posts found, show a default or error of some sort -->
<?php endif ?>