Support

Account

Home Forums ACF PRO List of fields from group.

Helping

List of fields from group.

  • Hello! First of all, sry for my english.
    Can someone explain me, how can i get list of fields and theirs value from group?
    The methods that existed before are not suitable.
    Now i can use it, it works:

    <?php if ( have_rows( 'chars' ) ) : ?>
    	<?php while ( have_rows( 'chars' ) ) : the_row(); ?>
    		<?php the_sub_field( 'm_weight' ); ?>
    		<?php the_sub_field( 'm_capacity' ); ?>

    and etc….

    But i have no idea, how to use it like array (foreach). I have a lot of parameters, and want to output code as simple, as possible …

    Moreover, this needs to be added to the cycle of posts, which are displayed according to the principle

    <?php foreach( $posts as $post ){ ...

  • According to the documentation, looping over a group field is similar to looping over a repeater field, so it should also be possible to use a foreach loop, as explained at https://www.advancedcustomfields.com/resources/repeater/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.