Support

Account

Home Forums Add-ons Options Page Select specific repeater rows from an options page Reply To: Select specific repeater rows from an options page

  • Sorry for bringing this post back again, I am trying this solution, but
    if( in_array( $title == $selection ) ) {

    Seems to lose my repeater. If I remove it all the repeater rows will show.

    The code I am using is below, any feedback on where I’ve gone wrong would be a huge help to me.

    <?php
         $selection = get_field('author_select');
              if( !empty( $selection ) ) {
                   if( have_rows( 'user_profile', 'option' ) ) {
    
                        while( have_rows( 'user_profile', 'option' ) ) {
                             the_row();
    
                             $title = get_sub_field('full_name');
    
                             if( in_array( $title == $selection ) ) {
    
                                  $title = get_sub_field('full_name');
                                  $org = get_sub_field('organization');
                                  $img = get_sub_field('profile_image'); 
                                  ?>
                                  <figure id="author">
                                       <div class="d-grid">
                                            <div class="left-contents">
                                                 <h4>ABOUT THE AUTHOR:</h4>
                                                 <div id="author-avatar"><img src="<?php echo $img; ?>" alt="<?php echo $title; ?>" /></div>
                                            </div>
                                            <div class="mid-contents">
                                                 <h5><?php echo $title; ?> | <?php echo $org; ?></h5>
                                            </div>
                                       </div>
                                  </figure>
                                  <?php
                                       }
                                  }
                             }
                        }
                   ?>