What Is The Loop?

Posted on Oct 29 2014 by in Software Tutorials WP-Attract-Tutorials 

In WordPress, there is a thing called The Loop. The Loop can be quite complex, but in reality, it is just a fancy way of describing how the content on your page is cycled. You may have noticed that posts and content on WordPress are organized by Tags, Categories, and other variables such as Date and Time.

In some themes, there is an option to put these items into a Loop Code so the content is continuously cycled for viewers. This is a great way to keep your content fresh and non-redundant. So how do you get this Loop installed?

The Loop code uses PHP and should be plugged into you page source code in the index.php file. Non-technical users will want to make sure they have the prior code saved somewhere before editing it so if there is a crash, you can have a backup. Here is a quick code visual from:



There are more examples of The Loop in the codex http://codex.wordpress.org/The_Loop for you to view, so make sure you go there and take a look at how this function can be implemented on your page. It can also offer the opportunity for multiple loops and various arrays to be setup, as well as a reset counter function by querying an object:



Anyone who enjoys puzzles and coding fun, the Loop can be an interesting challenge to implement to various themes because it helps newer coders iron out details on how the code is put together. When one looks at the various functions and queries it is easier to see how the logic is connected in the loop, as well as how special codes can really send new coders for a loop.

So take a minute and read the full explanation here, and begin your new site with one of our themes to practice out this simple, yet complex code.