Advanced Custom Fields wysiwyg in repeater

In wordpress, I’m using the Advanced Custom Fields plugin to create custom fields and I’m trying to put a wysiwyg editor in a repeater field.

Here is my code:

Read More
<? $args = array('post_type' => 'rates',);?>

<?php query_posts($args); ?>
<?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <?php $rates_col=get_field('rates'); ?>
    <? foreach( $rates_col as $rates_col_item){ ?>
        <div class="rate-item">
            <?php the_field('wysiwyg'); ?>
        </div>

    <? } ?>
    <?php endwhile; ?>
<?php endif; ?> 
<?php wp_reset_query()  ?> 

Where rates is the repeater name, and wysiwyg is the wysiwyg editor subfield name. The repeater field is working, and if I have more than one repeater row, then <div class="rate-item"> repeats to match it. But I don’t see any of the content which I write in the editor. Where is my mistake?

Related posts

2 comments

  1. Your mistake is:
    Your main field name is rates. And it contains any other subfields. When you create foreach loop, child fields in rates you need to call this way

    <?php echo $rates_col_item['wysiwyg'];?>
    

    And also, try to avoid query_posts, use get_posts(), WP_Query instead.

Comments are closed.