the_post()

You are here:

the_post()

Iterate the post index in the loop.

More Information More Information

Basic Usage

1
2
3
4
5
6
7
8
9
10
11
if ( have_posts() ) {
    while ( have_posts() ) {
 
        the_post(); ?>
 
        <h2><?php the_title(); ?></h2>
 
        <?php the_content(); ?>
 
    <?php }
}

Top ↑

Source Source

File: wp-includes/query.php

969
970
971
972
function the_post() {
    global $wp_query;
    $wp_query->the_post();
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.
Was this article helpful?
Dislike 0
Views: 6