[wp-testers] I have a quick question

Paul Robinson pablorobinson at gmail.com
Sat Dec 20 16:35:00 GMT 2008


Ahhh, I never thought about using get_children. That would be perfect for
what I want to do... I completely forgot that images are stored as posts,
they just have a different post type & mime type.

Thanks. :)

Paul.

2008/12/20 Paul <paul at codehooligans.com>

> Paul,
>
> There are a number of ways to get the post attachments.
>
> From wp-includes/media.php
>        get_children( array('post_parent' => $id, 'post_status' =>
> 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order'
> => $order, 'orderby' => $orderby) );
>
> Also you can just call get_posts:
>
>
>  get_posts('post_parent=$post->ID&post_type=attachment&orderby=title&order=ASC');
>
> P-
>
>
>
> On Dec 20, 2008, at 10:22 AM, 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
>>
>
> Paul
> paul at codehooligans.com
>
> The codehooligans.com office will be close Dec 24-26 to observe the
> Christmas Holiday. Will re-open Dec 29
>
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>


More information about the wp-testers mailing list