您可以通过以下方式获取与帖子关联的所有图像:
$args = array(
    \'post_type\'      => \'attachment\',
    \'post_mime_type\' => \'image\',
    \'post_parent\'    => $post_parent_id // you\'ll need to set this somewhere else
);
$images = get_children( $args )
 要从该图像转到第二个图像,您只需指向
$images[1], 但我不确定这是怎么回事,你可能需要把排序顺序弄乱一点。