Should I use loop in the single.php file?

I read many tutorials, and checked many premium/free theme’s source and most of them use loop in the single.php file.

The single.php file only displays one post, so I think the_post() is enough, while is unnecessary. Is there any reason why these themes (twentyfifteen, twentytwelve, etc..) use loop in the single.php file?

3 s
3

Stricktly speaking, you don’t need the loop in single post pages, you only need the call to the_post().

The reason for the_post() is that the_post() sets the $post global value to the single post post object

Leave a Comment