【コピペOK】Advanced Custom Feld 柔軟コンテンツの表示方法

Advanced Custom Feld

Advanced Custom Feld 柔軟コンテンツの表示方法について大変苦労したので下記に記述方法を記載しておきます。

まずは結論から、

<!-- ▼▼▼ 柔軟コンテンツ ▼▼▼ -->
<!--?php if (have_rows('posttext_set')) : ?-->
<!--?php while (have_rows('posttext_set')) : the_row(); ?-->
<!--?php if (get_row_layout() == 'textOne') : ?-->
<div class="text"><!--?php the_sub_field('blogtext'); ?--></div>
<!--?php elseif (get_row_layout() == 'imageOne') : ?-->
<div class="image"><img src="<?php the_sub_field('blogimage'); ?>" /></div>
<!--?php elseif (get_row_layout() == 'infoOne') : ?-->
<div class="info">

SIZE:<!--?php the_sub_field('blogsize'); ?--> / ¥<!--?php the_sub_field('blogprice'); ?-->
<a href="<?php the_sub_field('blogEcLink'); ?>">Utsubo Stock online shop</a> /
<a href="<?php the_sub_field('blogRakutenLink'); ?>">rakuten</a> /
<a href="<?php the_sub_field('blogYahooLink'); ?>">yahoo</a>
↑こちらでも販売しております。宜しければご覧下さいませ。

</div>
<!--?php endif; ?-->
<!--?php endwhile; ?-->
<!--?php endif; ?-->
<!-- ▲▲▲ 柔軟コンテンツ ▲▲▲ -->

ググって調べましたが結局はドキュメントを参考に書き直して動いたのが上記です。
やはりドキュメントは重要ですね。

Advanced Custom Feldドキュメント
https://www.advancedcustomfields.com/resources/

タイトルとURLをコピーしました