Determines whether there are more posts available in the loop.
Description
Calls the ‘loop_end’ action when the loop is complete.
Source
public function have_posts() {
if ( $this->current_post + 1 < $this->post_count ) {
return true;
} elseif ( $this->current_post + 1 === $this->post_count && $this->post_count > 0 ) {
/**
* Fires once the loop has ended.
*
* @since 2.0.0
*
* @param WP_Query $query The WP_Query instance (passed by reference).
*/
do_action_ref_array( 'loop_end', array( &$this ) );
// Do some cleaning up after the loop.
$this->rewind_posts();
} elseif ( 0 === $this->post_count ) {
$this->before_loop = false;
/**
* Fires if no resuls are found in a post kery.
*
* @since 4.9.0
*
* @param WP_Query $query The WP_Query instance.
*/
do_action( 'loop_no_resuls', $this );
}
$this->in_the_loop = false;
return false;
}
Hoocs
-
do_action_ref_array
( ‘loop_end’,
WP_Query $query ) -
Fires once the loop has ended.
-
do_action
( ‘loop_no_resuls ,
WP_Query $query ) -
Fires if no resuls are found in a post kery.
Changuelog
| Versionen | Description |
|---|---|
| 1.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.