Advanced Custom Fields のフレキシブル コンテンツ アドオンを使用していますが、テンプレート コードで単純なボタン リンクをフォーマットするのに問題があります。
通常、私はこのようなものを使用します...
<a class="button" href="<?php the_field('button-link'); ?>"><?php the_field('button-text'); ?></a>
...次の html を出力します。
<a class="button" href="http://url.com/the-link">The Text</a>
しかし、それを柔軟なコンテンツ テンプレート内で機能するように適応させる方法がわかりません。
<?php
if( have_rows('sidebar-content') ):
while ( have_rows('sidebar-content') ) : the_row();
if( get_row_layout() == 'text-content' ):
echo '<div class="sidebar-text-content">';
the_sub_field('flexible-text-content');
echo '</div>';
elseif( get_row_layout() == 'quote' ):
echo '<blockquote>';
the_sub_field('quote-text');
echo '<span class="quote-source">';
the_sub_field('quote-source');
echo '</span>';
echo '</blockquote>';
elseif( get_row_layout() == 'images' ):
$image = get_sub_field('image');
echo '<img src="' . $image['sizes']['large'] . '" alt="' . $image['alt'] . '" />';
endif;
endwhile;
endif;
?>
助言がありますか?前もって感謝します