[wp-hackers] the $post variable

Mark Jaquith mark.wordpress at txfx.net
Sat Jul 9 04:24:13 GMT 2005

BoBB wrote:

>I looked on the codex and I couldn't find alot documentation on the
>$post variable ... of course I am not really familiar with a Wiki so I
>might just not be finding it.
>What I need is a way to, within the loop, access the DB information
>for each post, such as the timestamp, for a template tag. Obviously
>grabbing the ID and submitting another query for each post would be
>very undesireable. Is there anything that stores information such as
>that? And what would be the best way to access it?
The posts returned are stored in $posts (array of objects) and $post is 
essentially foreach ($posts as $post) which is actually how the loop 
used to work in WP 1.2

So within the loop, $post is the post object currently being processed.  
You can access $post->name_of_column to grab the data you need.

More information about the wp-hackers mailing list