[wp-testers] I have a quick question

Hayes Potter hayes at redtiedesigns.com
Sat Dec 20 16:32:13 GMT 2008


Paul Robinson wrote:
> Ok so I'm developing a theme for 2.7 and I can't seem to find a function
> that allows you to get the images attached to a post using the posts ID. Is
> there a function pre-made to do this?
>
> Just to be clear I am looking for a function that you can give the posts ID
> and it will provide the IDs and stuff for all the attachments on that post.
>
> Paul.
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>
>   
Well inside The Loop you can use "<?php the_ID(); ?>", but I don't think
this is what your looking for.
This works outside the Loop but I'm not sure if you need this:

|global $wp_query;
$thePostID = $wp_query->post->ID;

also there are these two.

Get the latest post ID number:
$post->ID ORDER BY post_date ASC LIMIT 1

Get the earliest post ID number:
$post->ID ORDER BY post_date DESC LIMIT 1
|

-- 
Hayes Potter, CEO
Wordpress Expert
http://hayespotter.com
http://9milesmedia.com



More information about the wp-testers mailing list