From 04d470cbbdfba8a499a7c403ec0c596b6fc01542 Mon Sep 17 00:00:00 2001 From: rboren Date: Fri, 31 Dec 2004 21:49:48 +0000 Subject: [PATCH] Add rewind_posts(). git-svn-id: http://svn.automattic.com/wordpress/trunk@2026 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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); }