Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:Samsm/have posts

This article is a ROUGH DRAFT. The author is still working on this document, so please do not edit this without the author's permission. The content within this article may not yet be verified or valid. This information is subject to change.

Description

Returns true if there is a post available in the current query. Usually used at the beginning of the_loop.

Usage

This tag is usually used in the loop. In the example below, have_posts checks to make sure that there is a post avialable to be accessed with the_post.

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

Parameters

This tag has no parameters.