カスタムフィールドの画像オブジェクトから取得し表示されたのですが、ループしているため全て表示されてしまいました。
4枚の画像を表示するにはどうしたらいいですか?
<?php $images = get_field('images'); ?> <?php if ($images): ?> <?php foreach ($images as $image): ?> <img width="240" height="240" src="<?php echo $image['image']['sizes']['large']; ?>" alt=""> <?php endforeach; ?> <?php endif; ?>
回答1件
あなたの回答
tips
プレビュー