简体   繁体   中英

ACF Repeater field doesn't show up

I've got a problem with the repeater field that doesn't show up in this page and i don't understand why. When i call normal field it works, here is my code :

<?php query_posts(array('showposts' => 6,'category_name' => 'une')); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php if( have_rows('evenement') ): while ( have_rows('evenement') ) : the_row(); ?>
<?php the_sub_field('date_debut_evenement');?>
<?php endwhile; else: ?><?php endif; ?>
<?php endwhile; else: ?><?php endif; ?>

Thanks for your help !

Ben

Please add post id when you count acf rows:

<?php query_posts(array('showposts' => 6,'category_name' => 'une')); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php if( have_rows('evenement','$postID') ): while ( have_rows('evenement','$postID') ) : the_row(); ?>
<?php the_sub_field('date_debut_evenement');?>
<?php endwhile; else: ?><?php endif; ?>
<?php endwhile; else: ?><?php endif; ?>

I think i found the solution, i change the query with this and it seems to work fine :

<?php 
$query = new WP_Query( array(
'showposts' => 6,
'category_name' => 'une',
'post_type'=> array('post','spectacles','photos','videos')
) );
?>

<?php if($query->have_posts()) : while ($query->have_posts() ) : $query->the_post();?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM