the_post()
Iterate the post index in the loop.
Description
Source
File: wp-includes/query.php
function the_post() { global $wp_query; $wp_query->the_post(); }
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |
More Information
Basic Usage
if ( have_posts() ) { while ( have_posts() ) { the_post(); ?> <h2><?php the_title(); ?></h2> <?php the_content(); ?> <?php } }
Function the_post() checks whether the loop has started and then sets the current post by moving, each time, to the next post in the queue.