Support

Account

Home Forums ACF PRO FR, hope add shortcode/php code to the fields.

Solved

FR, hope add shortcode/php code to the fields.

  • Hi, if ACF can add shortcode/phpcode to the fields. it will easy to insert in the files to display the fields in the site. or provide the addon Advanced Custom Fields: Theme Code features. if possible add online templates libary where can provide a lot of template to everyone make the site powerful than ever.

    Thanks!

  • Is there a question there? ACF provides shortcodes for simple fields. The reason that there are no shortcodes for complex field types is that the possibilities are, well, too complex. If the developer built a shortcode for one possibility then he’d have to build them for all possibilities.

    If you’d like to contribute in a community of acf users that is providing more advanced stuff than can be found in the tutorials and documentation here, check out https://acfextras.com/

  • Hello,

    As Theme code plugin do, if I build any type of fields, it can create a php code which I can insert to the php file displaying the Custom fields. I think when we create a field, the field had an unique ID, and we can easy to control the field displaying. If it be realized we wouldnt write the_field every time. just use a simple code to show the field.

    Thanks!

  • I think that the plugin you’re referring to is a 3rd party add on and not something that is maintained by the developer of ACF.

    ACF shortcodes are very simple and will only work on basic field types: text, textarea, number, email, url. Also radio fields will work and select field if they only allow a single value. Beyond that you can’t use them without building your own shortcodes to do the work. Anything that could provide that level of code would need to be done by someone else, not to mention what I’ve already mentioned about it being extremely complex, it would be quite an undertaking for someone to build. Maybe someone will find this and want to do it.

  • 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') ): ?>
  • No, I can’t. As I said, the plugin that I think you’re talking about (https://wordpress.org/plugins/acf-theme-code/) was built by someone else. There is a pro version that appears to do repeaters and flex fields https://hookturn.io/downloads/acf-theme-code-pro/

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘FR, hope add shortcode/php code to the fields.’ is closed to new replies.