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 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 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>';
    									 } ?>
    							<div class="details">
    									<div id="title"></div>
    									<div id="desc"></div>
    	            <?php endif; // if( get_field('to-do_lists') ): ?>