the_post() WordPress Function
The post() function is one of the most important functions in WordPress. It is used to display a post or page on a WordPress site. The post() function can be used in a number of ways, but the most common use is to simply call it with the ID of the post or page you want to display.
the_post() #
Iterate the post index in the loop.
More Information
Basic Usage
if ( have_posts() ) {
while ( have_posts() ) {
the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php }
}
Source
File: wp-includes/query.php
function the_post() {
global $wp_query;
$wp_query->the_post();
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |