Support

Account

Home Forums ACF PRO Using get_template_part in acf Reply To: Using get_template_part in acf

  • Thank’s John, that’s worked.

    My working code is below for reference.

    
    // check if the repeater field has rows of data
    if( have_rows('sections') ):
    
    while ( have_rows('sections') ) : the_row(); 
    
    $title = get_sub_field('title'); 
    $section = get_sub_field('section'); ?>
    
    		<div class = "gen_section" id = "section_<?php echo $title; ?>">
    			<div class = "wrap">
                <!--Need get_template_part here  ($icon)-->
    			<span class = "icon_span"><?php if ( $icon ) { get_template_part('svg/inline', get_sub_field('icon'));  } ?>
    				<h2 class = "section-title"> <?php echo $title; ?> </h2>
    			</span>	
    
    		 	<?php echo $section; ?>	
    
    			</div>
    		</div> <?php
    
        endwhile;
    
    else :
    
        // no rows found
    
    endif; ?>