Support

Account

Home Forums Add-ons Repeater Field Retrieving number value from field order? Reply To: Retrieving number value from field order?

  • Thank you. I tried this, and it “worked” but for example in one article, there are 7 rows, on every single row it is displaying “1235467”. Any ideas?

    Below is the code without your suggestions. I learn by editing examples I have found. Please forgive me if the code isn’t exactly the best method.

    [‘list_item_number’] is where I wanted the number to appear.

    // ***************
    // List Article Item
    // *************** 
    if (get_row_layout() == "list_article"){  //Flex Field Name
    	$rows = get_sub_field('list'); //Repeater Field Name
    	echo '<div class="toplist-container flextainer">';
    //REPEATER START
      if ($rows){ 
            foreach($rows as $row){ 
    	echo '<div class="toplist-box">';
            echo '<div class="toplist-heading"><span class="toplist-number ';
    	the_sub_field("numbers_switch_1");
    	echo '">#'.$row['list_item_number'].'</span><span class="toplist-title"> '.$row['list_item_title'].'</span></div><!--/heading-->';
    	echo '<div class="'.$row['show_list_image'].'" style=" background-image: url('.$row['list_item_image'].');"></div><!--/image-->';
    	echo '<div class="toplist-text">'.$row['list_item_content'].'</div><!--/text-->';
            echo '<span class="clear-fix"></span></div><!--/toplist-box-->';
    	}
          } 
    //REPEATER END
    	echo '<span class="clear-fix"></span></div><!--/flextainer-->';
     }