From the course: WordPress: Customizing Themes with Genesis

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

The WordPress loop

The WordPress loop

From the course: WordPress: Customizing Themes with Genesis

Start my 1-month free trial

The WordPress loop

- [Developer] In programming terms, a Loop is a series of commands that gets executed over and over until some particular condition is met. Here we are in the WordPress Theme Handbook and we've got this simple example of a Loop. It basically says, "Hey, we're checking to see if there are any posts and if there are, while we've got them, let's go ahead and display something about them." And a basic WordPress theme template might look something like this. You just add your get header function call to the beginning and after that you will get sidebar and get footer and then you would sandwich the Loop somewhere in between. In terms of WordPress theming, the Loop is used in any PHP template file where you want to display information about a post. The Loop loops through each post retrieved through the current page one at a time. Now, whether the Loop retrieves a single post such as a single blog post, or a whole bunch of…

Contents