アイキャッチ画像の指定をせず、画像を表示する。
ループ内での使用が必須となる。
$imgset = get_children("post_parent=$id&post_type=attachment&post_mime_type=image"); if ($imgset) : $keys = array_keys($imgset); $num = $keys[0]; $thumb = wp_get_attachment_thumb_url($num); echo '<a href="' . clean_url(get_permalink()) . '" title="' . the_title_attribute('echo=0') . '"><img src="' . clean_url($thumb) . '" width="120" height="120" alt="' . the_title_attribute('echo=0') . '" /></a>'; else : //画像がない時の処理 echo '<a href="' . clean_url(get_permalink()) . '" title="' . the_title_attribute('echo=0') . '"><img src="' . clean_url($thumb) . '" width="120" height="120" alt="' . the_title_attribute('echo=0') . '" /></a>'; endif;