The example shows how to get one child field.
How to bring the two fields?
<?php
// 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
the_sub_field('sub_field_name');
endwhile;
else :
// no rows found
endif;
?>
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
Screen
https://yadi.sk/i/Y3U1sZZzybrBo
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 🙂