サムネイルがある場合の処理は
<php
$first_img = '';
if ( preg_match( '/<img.+?src=[\'"]([^\'"]+?)[\'"].*?>/msi',
$item->get_content(), $matches )
) { $first_img = $matches[1]; } ?> で完結してます。

<php
if(empty($first_img)) $first_img = "/images/default.jpg";
?> でサムネイルがない場合の画像の表示は成功してます。

<span class="thumbnail2">
<img class="heit6" src="<php echo esc_attr( $first_img ); ?>" alt="" />
</span>
<php endif; ?>は <php endif; ?>が構文重複を起こしているため削除すると、

以下のサムネイルがない場合のパーマリンク、タイトルの処理が無効になります。

<span class="thumbnail2">
<img class="heit6" src="<php echo esc_attr( $first_img ); ?>" alt="" />
</span>
<php endif; ?>
</a>
<div class="cell medium-79">
<a class="name21" href="<php echo $item->get_permalink(); ?>">
<php echo $item->get_title();// タイトル ?>
</a>
</div></div><!-- 記事中の1枚目の画像を取得終了-->

<php endforeach; ?>
</div>
<php endif; ?>