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; ?>
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.