Support

Account

Home Forums Add-ons Flexible Content Field Get another page's Flexible Content Reply To: Get another page's Flexible Content

  • if(have_rows('page_builder', $this_page)):
          while(have_rows('page_builder', $this_page)): the_row();
              if( get_row_layout() == 'page_content_block' ):
    
    	          $this_text = get_sub_field('page_content_editor');
    	          $this_text_plain = strip_tags($this_text);
    
                    // flexible row logic
              endif;
          endwhile;
    endif;

    I found that if you try and pass get_sub_field('repeater_page_object')->ID as the have_rows() $id parameter, it will cause an infinite loop, however, if you store these values as a variable on each loop index it works fine.

    The above is an example of how I managed to get the result I wanted. This was placed within a flexible content loop in a if (get_row_layout == 'x') { } statement.