

To put it simply, the Loop is true to its name: it loops through each post retrieved for the current page one at a time and performs the action specified in your theme. Any HTML or PHP code in The Loop will be processed for each post.


The Loop extracts the data for each post from the WordPress database and inserts the appropriate information in place of each template tag. Within the Loop, WordPress retrieves each post to be displayed on the current page and formats it according to your theme’s instructions. How many posts are retrieved is determined by the number of posts to show per page defined in the Reading settings. The Loop is the default mechanism WordPress uses for outputting posts through a theme’s template files. Style Posts from Some Categories Differently.
