Support

Account

Home Forums Add-ons Flexible Content Field Flexible Content not rendering on frontend Reply To: Flexible Content not rendering on frontend

  • You cannot combine

    
    get_field('repeater || group || flexible conentent')
    

    and

    
    have_rows()
    

    when dealing with sub field of any kind.

    Everything is in the returned array here

    
    $relevant = get_field('relevant');
    

    and you must deal with looping over that array

    
    $content_boxes = $relevant['content_boxes'] 
    $content_rows = $content_boxes['content'];
    foreach ($content_rows as $content) {
      if ($content['acf_layout'] == 'new_article') {
         $title = $content['article_title'];
      }
    }
    

    Or you must start with and use have_rows() throughout

    
    if (have_rows('relevant')) {
      while (have_rows('relevant')) {
        the_row();
        if (have_rows('content_boxes')) {
          while (have_rows('content_boxes')) {
            the_row();
            if (have_rows('content')) {
              while (have_rows('content')) {
                the_row();
              }
            }
          }
        }
      }
    }