[wp-hackers] Newbie Q - can't get get_children to work

Matt Martz mdmartz at sivel.net
Sat Apr 11 14:02:55 GMT 2009


On Sat, Apr 11, 2009 at 9:57 AM, Jan Erik Moströ <lists at mostrom.pp.se> wrote:
> I've been trying to figure out why this code says that there are no images
>
> $images =& get_children( 'post_type=attachment&post_mime_type=image' );
> if( empty($images) ){
>    $result = 'No picts ';
> } else {
>    $result = 'Picts';
> }
>
>
> I'm obviously missing something ... but what ???

You are not including post_parent which is required so that it knows
what parent post to get children from.  that post_parent needs to be
the ID of the post.

-- 
Matt Martz
matt at sivel.net
http://sivel.net/


More information about the wp-hackers mailing list