Support

Account

Home Forums Add-ons Repeater Field Print different text based on the number of lines Reply To: Print different text based on the number of lines

  • i don’t know if i did it right, this is the code i managed to do and it works

    <?php 
      if( have_rows('misure_e_prezzi')):
        $rows = get_field('misure_e_prezzi' );
    	$my_fields = get_field_object('misure_e_prezzi');
        $specific_row = $rows[0];
        $first_row_price = $specific_row['prezzo' ];
    	$count = (count($my_fields['value']));
        $valuta = '€ ';
    	?>
    <div class='prezzo'>
    <?php 
    if ($count ==1)
      echo $valuta .number_format( $first_row_price, 2, ',', ' ');?></div>
    
    <?php
    
    if ($count >1)    
    echo 'A partire da: '?>
    <div class='prezzo'>
      
      <?php 
     if ($count >1)    
    echo  $valuta  .number_format( $first_row_price, 2, ',', ' ');?></div>
    <?php
    endif;
    ?>