Forum Replies Created

  • @paul115
    on the email template, you need to get the order ID first, like:

    $order_id = $order->id; 
    $section 	= get_field( 'location_section', $order_id );
    $column 	= get_field( 'location_column', $order_id );
    $row 		= get_field( 'location_row', $order_id );
    <p>Location of item is: <strong>S<?php echo $section; ?>-C<?php echo $column; ?>-R<?php echo $row; ?></strong></p>
  • To get the featured image from relationship, you need to use:

    <?php $featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'medium_large'); ?>

    This will grab the featured image URL from the ID, once you have the url, you can use it in img src or as an background.

    Hope this helps.

  • Thank you John, that solved it.

  • <?php if( have_rows('gallery-repeater') ): ?>
       <?php while ( have_rows('gallery-repeater') ) : the_row(); ?>
         <?php the_sub_field('gallery-name'); 
         $images = get_sub_field('gallery-images'); 
         if( $images ):?>
            <?php foreach( $images as $image ): ?>
    	   <a href="<?php echo $image['url']; ?>">
    	      <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
               <p><?php echo $image['caption']; ?></p>
            <?php endforeach; ?>
         <?php endif; 
    else :
    // no rows found
    endif; ?>


  • add_shortcode( 'qg_shortcode', 'qg_shortcode' );
    function qg_shortcode() {
        $buffer = '<h3>Post Titles</h3>';
        $q = new WP_Query(array(
            'post_type' => 'post',
            'posts_per_page' => 5
        while ($q->have_posts()) {
            $buffer = $buffer.get_the_title().'<br>';
        return $buffer;
  • [acf field="field_name" post_id="123"]

    This is a story about a boy named [acf field="name"]. He is [acf field="age"] years old.


  • For forms, its better to use Gravity forms or Contact form 7(Free Plugin).

    $field = get_field('equipement');
    if( $field ): ?>
    	<?php foreach( $field as $value ): ?>
    		<li class="<?php echo $value; ?>"><?php echo $value; ?></li>
    	<?php endforeach; ?>
    <?php endif; ?>
  • For me, I have done like this and it kinda worked for me.
    On Function center_map, if you are using more than 1 marker then on else section add

    map.setCenter( bounds.getCenter() );
    		map.setZoom( 4 );
    /* center_map */
    function center_map( map ) {
    	// vars
    	var bounds = new google.maps.LatLngBounds();
    	// loop through all markers and create bounds
    	$.each( map.markers, function( i, marker ){
    		var latlng = new google.maps.LatLng(, marker.position.lng() );
    		bounds.extend( latlng );
    	// only 1 marker?
    	if( map.markers.length == 1 )
    		// set center of map
    	    map.setCenter( bounds.getCenter() );
    	    map.setZoom( 4 );
    		// fit to bounds
    		//map.fitBounds( bounds );
    		map.setCenter( bounds.getCenter() );
    		map.setZoom( 4 );
  • Hi James
    In this case, how shall we hide that tab or remove that tab if get_field('fieldname', $post_id); is empty.

    Sorry to bother you, I found the solution:

    //adding new tab//
    add_filter( 'woocommerce_product_tabs', 'product_tab' );
    function product_tab( $tabs ) {
    if ( get_field('fieldname', $post_id) ) {
    $tabs[] = array(
    'title' => 'Specifications',
    'priority' => 15,
    'callback' => 'show_content'
    return $tabs;
    function show_content() {
    $downloads = get_field('fieldname', $post_id);
    if( $downloads ):
    echo get_field('fieldname', $post_id);

  • Hi James,
    My friend helped me out in this, removed all ACF map code and put this one, and it worked like a charm.

    function createMap(id){
    	var Element = $("#" + id);
    	if (Element.find(".marker").length != 1){
    	var latlng = new google.maps.LatLng(Element.find(".marker").data("lat"), Element.find(".marker").data("lng"));
    	var myOptions = {
    			zoom: 16,
    			center: latlng,
    			mapTypeId: google.maps.MapTypeId.ROADMAP,
    			disableDefaultUI: true,
    			mapTypeControl: false,
    			zoomControl: true,
    			scrollwheel: false,
    			zoomControlOptions: {
    					style: google.maps.ZoomControlStyle.SMALL
    	var map = new google.maps.Map(Element[0], myOptions);
    	console.log("Creating map at " + Element.attr('id'));
    	var marker = new google.maps.Marker({
    			icon: "<?php bloginfo('template_url'); ?>/img/custom_marker.png",
    			position: latlng,
    			map: map
    	return {map: map, marker: marker};
    var $ = jQuery;
    	$('.panel-collapse.collapse').parent().find(".panel-title a").click(function(){
    		var result = createMap($(this).parent().parent().parent().find(".acf-map").attr('id'));
    		if (result != null){
    			google.maps.event.addListenerOnce(, 'idle', function(){
    				google.maps.event.trigger(, 'resize');;
    	//Run create map on the first map - because it is already visible
  • This reply has been marked as private.
  • I must be dumb, i couldn’t figure out the right code. ๐Ÿ™

  • Hey I am using bootstrap 3 collapse, I still have the problem, the first map loads but other maps are not loading properly. Can you please help me out where I am wrong ?

  • Thank you Thomask, It worked for me.

  • Hi Jonathan
    I have solved this, I am loving this ACF.

    <ul class="nav nav-tabs" role="tablist">
      <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
      <?php if ( have_rows('repeater', 'option') ) {
    	while ( have_rows('repeater', 'option') ) : the_row(); 
    	$image = get_sub_field('repeater_subfield1', 'option' );
    	if($image) {
    	<li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
    	<?php }  } ?>
    <!-- Tab panes -->
    <div class="tab-content">
      <div role="tabpanel" class="tab-pane active" id="home">Home Text</div>
      <div role="tabpanel" class="tab-pane" id="profile">
        <?php  while ( have_rows('repeater', 'option') ) : the_row(); ?>
        <div class="col-sm-2 col-xs-6 color_showcase text-center"> 
        	<img src="<?php the_sub_field('repeater_subfield1'); ?>" alt=""> 
          	<?php the_sub_field('repeater_subfield2'); ?>
        <?php endwhile;  ?>
  • Hi Jonathan

    I used old code for trying only, my problem is:

    inside tab panel there are repeater subfields, if there are subfields it is fine to show the <li> tab but if no repeater subfields then I don’t need to show this <li> tab. (did you get me?).

    I am doing everything fine, but I am not able to echo all repeater fields in tab-pane, the first one will be missing, the first one will be echoed on first condition in <li>

    If you are not clear, I can send you wp-admin user and pass as well personally in your email.

  • <?php 
    $images = get_field(โ€˜bkg_slide_galleryโ€™, 'option');
    if( $images ): ?>
    <ul class="clearfix row">
    <?php foreach( $images as $image ): ?>
    <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
    <p><?php echo $image['caption']; ?></p>
    <?php endforeach; ?>
    <?php endif; ?>
Viewing 22 posts - 1 through 22 (of 22 total)