Make WordPress Core


Ignore:
Timestamp:
07/17/2005 04:58:13 PM (20 years ago)
Author:
ryan
Message:

in_the_loop() Props: Mark Jaquith fixes #1518

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/classes.php

    r2635 r2716  
    1010    var $post_count = 0;
    1111    var $current_post = -1;
     12    var $in_the_loop = false;
    1213    var $post;
    1314
     
    5657        $this->post_count = 0;
    5758        $this->current_post = -1;
     59        $this->in_the_loop = false;
    5860    }
    5961
     
    594596    function the_post() {
    595597        global $post;
     598        $this->in_the_loop = true;
    596599        $post = $this->next_post();
    597600        setup_postdata($post);
     
    601604        if ($this->current_post + 1 < $this->post_count) {
    602605            return true;
    603         }
    604 
     606        } elseif ($this->current_post + 1 == $this->post_count) {
     607            // Do some cleaning up after the loop
     608            $this->rewind_posts();
     609        }
     610
     611        $this->in_the_loop = false;
    605612        return false;
    606613    }
Note: See TracChangeset for help on using the changeset viewer.