Support

Account

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>