Home Forums Add-ons Repeater Field Repeater in Two Columns (again) Reply To: Repeater in Two Columns (again)

  • For 1) and 2)
    Are you restricted on old browser supports? cause i’d 100% suggest you just use the css columns to do that layout. it’s supported on all browser last 2 latest version now.


    <ul class="items">
        <?php while (have_rows('appetizers')): the_row(); ?>
                <h4><?php the_sub_field('item'); ?></h4>
                <p><?php the_sub_field('desc'); ?>$<?php the_sub_field('price'); ?></p>  
        <?php endwhile; ?>
    .items {
        column-count: 2;
        column-gap: 20px;

    If you can’t or don’t wanna use the css way, this is a cleaner way to split them:

        // get repeater values as array
        $appetizers = get_field('appetizers');
        // calculate how many items first
        $items_count = count($appetizers);
        // calculate how much half is, round up
        $items_half = ceil($items_count / 2);
        // split the repeater 
        $appetizers_chunks = array_chunk($appetizers, $items_half);
    <div class="section">   
        <div class="secthead"><?php the_title( '<h2>', '</h2>' ); ?></div>
        <?php foreach ($appetizers_chunks as $chunk): ?>
            <div class="items">
                    <?php foreach ($chunk as $value): ?>
                            <h4><?php echo $value['item']; ?></h4>
                            <p><?php echo $value['desc']; ?> $<?php echo $value['price']; ?></p>  
                    <?php endforeach; ?>
        <?php endforeach; ?>

    3) i’m not sure if i understand the question. Is your repeater field not already set on the category edit? where’s the repeater field at?