From 5a9ead8b0f79dd0e409737a35c946e0bfebf3172 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 31 Dec 2004 21:49:48 +0000 Subject: [PATCH] Add rewind_posts(). git-svn-id: https://develop.svn.wordpress.org/trunk@2026 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/classes.php | 7 +++++++ wp-includes/functions.php | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/wp-includes/classes.php b/wp-includes/classes.php index b5583f2696..187b417ad1 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -578,6 +578,13 @@ class WP_Query { return false; } + + function rewind_posts() { + $this->current_post = -1; + if ($this->post_count > 0) { + $this->post = $this->posts[0]; + } + } function query($query) { $this->parse_query($query); diff --git a/wp-includes/functions.php b/wp-includes/functions.php index b31b94c38f..3a808a55ec 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1232,6 +1232,12 @@ function have_posts() { return $wp_query->have_posts(); } +function rewind_posts() { + global $wp_query; + + return $wp_query->rewind_posts(); +} + function the_post() { start_wp(true); }