0
リピータフィールドを使用して、コンテンツブロックと画像ブロックをリストとして表示します。しかし、私はすべての画像に1つのクロップサイズを使用したくありません。例えばリピータフィールドのACF複数の画像サイズ
:
List item 1: Image size 1
List item 2: Image size 2
List item 3: Image size 2
List item 4: Image size 3
これはさえ可能ですか?
私が現在使用しているマークアップは次のとおりです。
<ul>
<?php while(have_rows('home-features')): the_row();
// vars
$image = get_sub_field('image');
$description = get_sub_field('description');
$url = get_sub_field('url');
?>
<li>
<a href="<?php echo $url; ?>">
<div>
<h3><?php echo $description; ?></h3>
</div>
</a>
</li>
<?php endwhile; ?>
</ul>
イメージのカウントを保持し、whileループ内でそれをインクリメントするために使用できる変数を作成し、その変数を使用して必要なイメージサイズを決定します。何かが好きです:https://pastebin.com/uBqz0MjE – naththedeveloper