Support

Account

Home Forums Front-end Issues How to get the data outside the loop? Reply To: How to get the data outside the loop?

  • Without knowing the exact index of each nested repeater it will be impossible to get a value from a specific nested sub field with such a complex setup. But in order to loop through this structure outside of the loop is to provide the post ID for the first

    
    if (have_rows('page', $post_id)) {
      while (have_rows('page', $post_id)) {
        the_row();
        // nested loops here
      }
    }
    

    If you do know the exact index at each lever you can use get_post_meta() as suggested by @willh, this is how the meta key can be constructed. nested field indexes start at 0 and not 1.

    
    $meta_key = "page_{$index}_row_{$index}_columns_{$index}_elements_{$index}_field_name";
    $value = get_post_meta($post_id, $meta_key, true);