Support

Account

Home Forums Add-ons Repeater Field Taxonomy in repeater field shows ID Reply To: Taxonomy in repeater field shows ID

  • I think you and I are trying to do the same thing.
    I’ve created a taxonomy called “category” inside of my repeater “asset”, and now i’m trying to retrieve all the names selected from that taxonomy. (I’m also sorting them in ASC order…)

    Example of what I’m doing:

    <?php
                      $rows = get_field('asset');
     
                      if($rows) {
     
                        foreach($rows as $key => $row) {
                          $column_id[$key] = $row['id'];
                        }
                        array_multisort($column_id, SORT_ASC, $rows);
     
                        $i = 0;
                        foreach($rows as $row) {
                            $taxonomyterm="";
                            for($i = 0; $i < count($row['category']); $i++) {
                                    $taxonomyterm = $taxonomyterm . $row['category'][$i] -> name . ' ';
                            }
                          echo '<div class="mix img ' . $taxonomyterm . '"><img src="' . $row['image'] . '"/><h4>' . $row['name'] . '</h4>' . $row['description'] . '<div class="overlay"><a href="' . $row['file'] . '" class="expand" download>↓</a><a class="close-verlay hidden">x</a></div></div>';
                          $i++;
     
     
                        }
                      }
                    ?>

    Try this:

    <?php
                    $rows = get_field('explicit_component');
     
                      if($rows) {
     
                        $i = 0;
                        foreach($rows as $row) {
                            $taxonomyterm="";
                            for($i = 0; $i < count($row['explicit_component_type']); $i++) {
                                    $taxonomyterm = $taxonomyterm . $row['explicit_component_type'][$i] -> name . ' ';
                            }
    
                          echo '<div id="commitments"><h3>' . $taxonomyterm . '</h3>' . $row['explicit_component_text'] . '</div>';
                          $i++;
     
     
                        }
                      }
                  ?>