Home Forums ACF PRO Several subsidiaries in the fields repeater


Several subsidiaries in the fields repeater

  • The example shows how to get one child field.
    How to bring the two fields?

    // check if the repeater field has rows of data
    if( have_rows('repeater_field_name') ):
     	// loop through the rows of data
        while ( have_rows('repeater_field_name') ) : the_row();
            // display a sub field value
    else :
        // no rows found

    I need to make a table with two values that were added to the line, but I can not embed it in the template ..

  • I’m trying to bring in such a way

    <?php if( have_rows('servise_price') ): ?>
    	<?php while( have_rows('servise_price') ): the_row(); 
    		// vars
    		$content = get_sub_field('servise_name');
    		$price = get_sub_field('serv_price');
    		    <?php echo $content; ?>
    			<?php echo $price; ?>
    	<?php endwhile; ?>
    <?php endif; ?>

    The result is not what you want


    Please help me

  • Hi @odyssey3080

    Your code looks correct for me. Could you please make sure that you have set the price correctly? Also, could you please debug the repeater like the following?

    var_dump( get_field('servise_price') );

    Thanks 🙂

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

You must be logged in to reply to this topic.