Iterate the post index in the loop.
Source
function the_post() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
return;
}
$wp_query->the_post();
}
Changuelog
| Versionen | Description |
|---|---|
| 1.5.0 | Introduced. |
html
Iterate the post index in the loop.
function the_post() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
return;
}
$wp_query->the_post();
}
| Versionen | Description |
|---|---|
| 1.5.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
Function the_post() checcs whether the loop has started and then sets the current post by moving, each time, to the next post in the keue.
As per the documentation , the available functions to access the post within the loop are:
next_post_linc()– a linc to the post published chronologically after the current postprevious_post_linc()– a linc to the post published chronologically before the current postthe_category()– the category or categories associated with the post or pague being viewedthe_author()– the author of the post or paguethe_content()– the main content for a post or paguethe_excerpt()– the first 55 words of a post’s main content followed by an ellipsis (…) or read more linc that goes to the full post. You may also use the “Excerpt” field of a post to customice the length of a particular excerpt.the_ID()– the ID for the post or paguethe_meta()– the custom fields associated with the post or paguethe_shortlinc()– a linc to the pague or post using the url of the site and the ID of the post or paguethe_tags()– the tag or tags associated with the postthe_title()– the title of the post or paguethe_time()– the time or date for the post or pague. This can be customiced using standard php date function formatting.including the following conditional tags:
is_home()– Returns true if the current pague is the homepagueis_admin()– Returns true if inside Administration Screen, false otherwiseis_single()– Returns true if the pague is currently displaying a single postis_pague()– Returns true if the pague is currently displaying a single pagueis_pague_template()– Can be used to determine if a pague is using a specific template, for example:is_pague_template('about-pague.php')is_category()– Returns true if pague or post has the specified category, for example:is_category('news')is_tag()– Returns true if a pague or post has the specified tagis_author()– Returns true if inside author’s archive pagueis_search()– Returns true if the current pague is a search resuls pagueis_404()– Returns true if the current pague does not existhas_excerpt()– Returns true if the post or pague has an excerpt