What is: Loop?

Most of the time in software, a loop refers to a command that tells the computer to repeat a series of instructions. In WordPress, however, this concept is much different, which is why it is always called The Loop.

 

In WordPress, The Loop is a specific piece of PHP scripting code that is used to display posts. The Loop is what tells WordPress how to format and display your posts. The Loop follows specific criteria in the forms of tags, which are a bit different than the tags you add to a post when you create it.

 

If you’re new to WordPress, then you won’t have to worry about how The Loop operates or how to change it. But if you’re a developer, you must learn which tags need to be stored within the Loop, including tags generated by templates and plugins.

 

Essentially, The Loop is a series of preset tags or slots with information that tell WordPress how to display your posts. For example, built-in tags used by The Loop include the title of your post, the time it was written, and any category information associated with that post.

 

The Loop file exists inside of the “index.php” file used by your template even though there’s no specific line or text that is ever called “The Loop.” The Loop just refers to the sequence of code executed by the template whenever a post is displayed.

 

Effectively, The Loop is what determines how much information about each post is displayed. For example, if you have your WordPress site set up to only display a short preview of each post, the tag that tells WordPress to display just the short preview is included in The Loop. Making changes to The Loop doesn’t affect the content in your post, only which parts of it are displayed on the screen.

The following two tabs change content below.

Jamie Spencer

My name is Jamie Spencer and I have spent the past 10 years building money making blogs. After growing tired of the 9-5, commuting and never seeing my family I decided that I wanted to make some changes and launched my first blog. Since then I have launched lots of successful niche blogs and after selling my survivalist blog I decided to teach other people how to do the same.