0
고급 사용자 지정 필드에 유연한 콘텐츠 추가 기능을 사용하고 템플릿 코드에서 간단한 단추 링크의 서식을 지정하는 데 문제가 있습니다. 나는 이런 식으로 뭔가를 사용하는 거라고 일반적으로WP : 고급 사용자 지정 필드 - 유연한 콘텐츠 링크 서식
...
<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;
?>
의견이 있으십니까? 다음과 같이 미래에이 정보가 도움이 찾을 수 있습니다 사람들을 위해 사전