2016/06/21
Wordpress プラグイン
ACF Repeater Fieldをご紹介しましたが、
テキストは問題なく表示されるものの
画像がいろいろな参考サイトの通りにやってみても表示されませんでした。
原因は不明ですが、下記のソースコードを試したところ表示されました。
参考サイト
ACF | Repeater
<?php if( have_rows('repeater_field_name') ): ?>
<ul class="slides">
<?php while( have_rows('repeater_field_name') ): the_row();
// vars
$image = get_sub_field('image');
$content = get_sub_field('content');
$link = get_sub_field('link');
?>
<li class="slide">
<?php if( $link ): ?>
<a href="<?php echo $link; ?>">
<?php endif; ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" />
<?php if( $link ): ?>
</a>
<?php endif; ?>
<?php echo $content; ?>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
以上、備忘録でした。
2026/11/07
神社
2026/11/06
AI
2026/11/05
Wordpress
ホームページ制作
2026/11/04
Mac
2026/11/03
AI