Support

Account

Home Forums Add-ons Flexible Content Field Flexible Content Field inside Clone Field Reply To: Flexible Content Field inside Clone Field

  • The problem is that you use this to get the clone field

    
    $callout = get_sub_field('fullscreen_callout_clone');
    

    and then try to use this to get the show the layouts

    
    if (have_rows('callout_content') :
               while (have_rows('callout_content') : the_row() 
    

    You either need to deal with both of these using loops or array, you cannot mix them

    
    // loops
    if (have_rows('fullscreen_callout_clone')) {
      while (have_rows('fullscreen_callout_clone')) {
        the_row()
        $color = get_sub_field('background_color');
        if (have_rows('callout_content')) {
          while (have_rows('callout_content')) {
            the_row();
            //... etc
          }
        }
      }
    }
    

    OR

    
    // arrays
    $callout = get_sub_field('fullscreen_callout_clone');
    if ($callout) {
      $color = $callout['background_color'];
      $layouts = $callout['callout_content'];
      if ($layouts) {
        foreach ($layouts as $layout) {
          if ($layout['acf_fc_layout'] == 'image') {
            $image = $layout['image'];
            // .. etc
          }
        }
      }
    }