我知道图像自定义字段的值将为我提供附件ID。在所有自定义字段的循环中,如何确定字段是否为图像?然后获取附件的图像URL?
我的代码:
$args = array( \'post_type\' => array( \'my_type\'),
\'posts_per_page\' => 1000,
\'fields\' => \'all\' );
$loop = new WP_Query( $args );
// Custom fields being attached
$retArray = array();
while ( $loop->have_posts() ) : $loop->the_post();
$custom_fields = get_post_custom($post->ID);
// Some code to get the actual image url from fields that are images:
// MISSING!
// Combine $post and custom field array to new array
array_push($retArray, array(\'post\' => $post, \'fields\' => $custom_fields));
endwhile;