Why do themes have `while( have_posts() )` in templates like single.php?

Example: https://github.com/markjaquith/WordPress/blob/master/wp-content/themes/twentyeleven/single.php

Isn’t single.php’s purpose to show single posts?

Related posts

Leave a Reply

1 comment

  1. The idea is to ensure that all the content is displayed properly. Some functions are not available outside of The Loop, as it’s called, so depending on what you are doing, it may be advantageous to start the loop, even if you’re relatively certain it will only be used for one post object.