Home › Forums › Add-ons › Repeater Field › Limit the output of a repeater field with array_slice › Reply To: Limit the output of a repeater field with array_slice
Ok i think i’ve figured things out. If anyone knows a more clean way i would be curious how to accomplish but for the moment the following just works out fine. Best regards Ralf
<figcaption class="bottombox fp-bb">
<h3 class="bran-bn fp-pro-title"><?php the_title(); ?></h3>
<?php
if(have_rows( 'pro_services' ) ): ?>
<ul class="mus-li fp-pro-serv">
<?php
$fp_list_slice = array_slice( get_field('pro_services'), 0, 2 );
foreach($fp_list_slice as $fp_list_count) { ?>
<li class="fp-lister"><?php
echo $fp_list_count['pro_service_single'];
?></li><?php } ?>
</ul>
<?php endif; ?>
<p class="fp-pro-excerpt"><?php acf_excerpt( 'pro_description', 20, ' <span class="fp-pro-more">[...]</span>' ); ?></p>
</figcaption>
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.