前提・実現したいこと
ACFの「Group」を使用して入力がなかった場合、ソースを非表示にしたいです。
下記のソースでは未入力でも出てしまいます。
どなたか対応策を知っている方がおりましたら教えていただけないでしょうか
プラグイン:Advanced Custom Fields
フィールドタイプ:Group 「area」
Group 「area」の中身:
↓
フィールドタイプ:テキスト 「ttl」
フィールドタイプ:テキスト 「txt」
発生している問題・エラーメッセージ
■「get_field('area')」出力ソース array(2) { [ttl"]=> string(0) "" ["txt"]=> string(0) "" }
該当のソースコード
<?php if( have_rows('area') ):?> <?php while ( have_rows('area') ): the_row();?> <div><span><?php the_sub_field('ttl'); ?></span></div> <div<?php the_sub_field('txt'); ?></div> <?php endwhile;?> <?php endif; ?>
試したこと
<?php if( get_field('area') ):?> <?php endif; ?> を使用してみたりしました
あなたの回答
tips
プレビュー