the_post()
Iterate the post index in the loop.
Description Description
Source Source
File: wp-includes/query.php
function the_post() {
global $wp_query;
$wp_query->the_post();
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
More Information More Information
Basic Usage
if ( have_posts() ) {
while ( have_posts() ) {
the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php }
}
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
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.