WordPress.org

Forums

get_children in archive (1 post)

  1. masai2k
    Member
    Posted 1 year ago #

    Hi,
    I have problems to get some images with this code inserted in a post inside the category page:

    $args = array(
    	'numberposts' => 1,
    	'order'=> 'ASC',
    	'post_mime_type' => 'image',
    	'post_parent' => $pageChild->ID,
    	'post_status' => null,
    	'post_type' => 'attachment'
    	);
    	$attachments = get_children( $args );
    	if ($attachments) {
    		foreach($attachments as $attachment) {
    			$myimg= '<img src="'.wp_get_attachment_thumb_url( $attachment->ID ).'>';
    		}
    	}

    I read a lot of posts in this forum but nobody gave the right answer... please help me!!

Topic Closed

This topic has been closed to new replies.

About this Topic