Support

Account

Home Forums Add-ons Repeater Field Options Page Repeater Row of Current Page Only Reply To: Options Page Repeater Row of Current Page Only

  • Hi John,

    Thanks for your help, just needed to change $post_id to get_the_ID() in your example and it worked! Yaay.

    <?php 
    $current_post = get_the_ID();
    if( have_rows('acf-colours', 'option') ):
     while( have_rows('acf-colours', 'option') ) : the_row();
     $post_objects = get_sub_field('pages');
      if( ($post_objects) ):
        foreach ($post_objects as $post_object) {
          if ($post_object == $current_post) {
     ?> sub-menu-<?php the_sub_field( 'colour' );
    	  } // end if current post
        } // end foreach post
      endif;
     endwhile;
    endif;
    ?>

    Thanks again for your help.