Translations of this page:

Wordpress Loop

Throughout this manual we've been talking about working with Wordpress loop, but what is Wordpress loop?

The code defines the loop as follows:

The Loop is used by WordPress to display each of your posts. Using The Loop, WordPress processes each of the posts to be displayed on the current page and formats them according to how they match specified criteria within The Loop tags. Any HTML or PHP code placed in the Loop will be repeated on each post. When WordPress documentation states “This tag must be within The Loop”, such as for specific Template Tag or plugins, the tag will be repeated for each post.
For example, among the information The Loop displays by default: the Title (the_title()), Time (the_time()), and Categories (the_category()) for each post. Other information about each post can be displayed with the appropriate Template Tags or (for advanced users) by accessing the $post variable, which is set with the current post's information while The Loop is running.

We can find more information about the loop and see the loop in action.

Working within the loop is placing code inside these lines of code.

Loop starts with:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

and ends with

<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

We can find more information and examples on the above links.

wordpress_loop_v20.txt · Last modified: 2011/08/02 19:20 by bcorona