Home › Forums › ACF PRO › FR, hope add shortcode/php code to the fields. › Reply To: FR, hope add shortcode/php code to the fields.
I talk about the methods of fields displaying. Such as the flexible field, if I want show it in the page, I need write lots of code to show it in the page. for example, I create a field I need insert below code in the single page. Can U provide various way to show the fields.
// check if the repeater field has rows of data
if( have_rows('app-img') && is_single() ): ?>
<hr class="featurette-divider2" id="showcase_carousel">
<div class="container-img marketing">
<div class="page-header">
<h2 class="slim">截图<br><small>(可以左右滑动查看!)</small></h2>
</div>
<div class="featurette">
<div class="controls marginbottom">
<button class="btn btn-default" id="showcase_prev"><i class="fa fa-angle-left"></i> Prev</button>
<span class="divider"></span>
<button class="btn btn-default" id="showcase_next">Next <i class="fa fa-angle-right"></i></button>
</div>
</div>
</div>
<div class="featurette featurette_full">
<div class="mightyslider_carouselModern_skin clearfix" id="showcase">
<div class="frame" data-mightyslider="width: 1170, height: 550">
<ul class="slide_element">
<?php $rows = get_field('app-img'); ?>
<?php foreach($rows as $row)
{
echo '<li class="slide" data-mightyslider="cover:\'';
echo $row['data-cover'].'\', title: \'';
echo $row['data-title']. '\', desc: \'';
echo $row['data-desc']. '\'"></li>';
} ?>
</ul>
</div>
<div class="details">
<div>
<div id="title"></div>
<div id="desc"></div>
</div>
</div>
</div>
</div>
<?php endif; // if( get_field('to-do_lists') ): ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.