php - ACF Flexible content - basic text field -


i'm working on acf custom fields flexible content wordpress. i'd make flexible content appear, use code found on acf website. create fields on acf, nothing appear.

• here made on acf : name of fexible content
• , here sub fields

this text area , normal texte title

• here code

<?php /* template name: ateliers */ ?>   <?php get_header(); ?>       <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>  <?php  // check if flexible content field has rows of data if( have_rows('ateliers') ):       // loop through rows of data     while ( have_rows('atelieratelier') ) : the_row();          if( get_row_layout() == 'content' ):              the_sub_field('atelier_01');           elseif( get_row_layout() == 'content' ):               the_sub_field('texte_atelier');          endif;      endwhile;  else :      // no layouts found  endif;  ?>  <?php endwhile; ?>  <?php get_sidebar(); ?> <?php get_footer(); ?>  </div> </body> </html> 

thanks help

i'm going go ahead , write proper answer one...

row: ateliers

field: atelier_01 , texte_atelier

layout: atelieratelier

your if/while should both row.

 <?php if (have_rows('ateliers')){ ?>      <?php while (have_rows('ateliers')) { the_row(); ?>      <!--start row layout-->        <?php if (get_row_layout() == 'atelieratelier') { ?>          <?php the_sub_field('atelier_01')?>          <?php the_sub_field('texte_atelier')?>        <?php }?> <!--if had more layouts elseif or migrate switch statement-->       <!--end row layout-->      <?php } // while   ?>     <?php } ?> 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -