[wp-hackers] New proposed function: in_loop() to determine "in the loop" status

Ryan Boren ryan at boren.nu
Sat Jul 16 22:58:17 GMT 2005


On Sat, 2005-07-16 at 18:36 -0400, Mark Jaquith wrote:
> Until now, there's been no good way to figure out if you are currently 
> in "the loop."  There were hacky methods, such as checking $post or 
> $wp_query->current_post against $wp_query->post_count, but those methods 
> either fail after the loop, or on the last post in the loop.
> 
> I've created a ticket with a set of patches that will fix this.
> http://trac.wordpress.org/ticket/1518
> 
> in_loop() returns true or false, depending on your in-the-loop status.

Cool by me.  Do we want to call it in_loop() or in_the_loop()?  I ask
because we refer to it as "The Loop" in so many places.  Either way is
fine by me, just wondering if there is a preference.

Ryan



More information about the wp-hackers mailing list