From 22bf595381d4e9be47b072ad0b27bc24c535ff2c Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 26 May 2009 23:57:01 +0000 Subject: [PATCH] Fix loop start, loop end workflow. Props Denis-de-Bernardy. fixes #9944 git-svn-id: https://develop.svn.wordpress.org/trunk@11464 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/query.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 2e2aa5aeb0..f9fffe35a4 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -2385,11 +2385,12 @@ class WP_Query { function the_post() { global $post; $this->in_the_loop = true; + + if ( $this->current_post == -1 ) // loop has just started + do_action_ref_array('loop_start', array(&$this)); + $post = $this->next_post(); setup_postdata($post); - - if ( $this->current_post == 0 ) // loop has just started - do_action_ref_array('loop_start', array(&$this)); } /** @@ -2661,8 +2662,6 @@ function wp_old_slug_redirect () { function setup_postdata($post) { global $id, $authordata, $day, $currentmonth, $page, $pages, $multipage, $more, $numpages; - do_action_ref_array('the_post', array(&$post)); - $id = (int) $post->ID; $authordata = get_userdata($post->post_author); @@ -2689,6 +2688,9 @@ function setup_postdata($post) { $pages[0] = $post->post_content; $multipage = 0; } + + do_action_ref_array('the_post', array(&$post)); + return true; }