0

This is a pretty weird one.

I'm in the process of making a detail page template and need two repeaters fields to display on the same page. I've done this multiple times of different pages and on one page there are 3 repeater fields and they display fine.

There are two blocks detail__other & detail__information

DO = detail__other DI = detail__information

This is going to take some explaining

If I put DI above DO, DIn displays correctly and DO does not render, if however, I do it the other way round they both don't render.

If I then put DI above DO and duplicate DI markup directly underneath, both DI and DO render.

I'm sure that there is a syntax error but I've checked it through multiple times but can't find any.

Code Below:

<div class="detail__other">
    <div class="detail--contain">
        <div class="detail__heading detail__heading--black">Other Products</div>
        <?php if(have_rows('other_products')) : ?>
            <ul class="detail__other-products">
                <?php while( have_rows('other_products') ): the_row(); ?>
                    <li class="detail__others-products-item">
                        <?php $post_object = get_sub_field('products'); ?>
                        <?php if( $post_object ): ?>
                            <?php $post = $post_object; setup_postdata( $post ); ?>
                            <a href="<?php the_permalink(); ?>"><img src="<?php the_post_thumbnail_url('featured-small'); ?>" alt="<?php the_title(); ?>" /></a>
                            <?php the_title(); ?>
                            <?php wp_reset_postdata(); ?>
                        <?php endif; ?>
                    </li>
                <?php endwhile; reset_rows(); ?>
            </ul>
        <?php endif; ?>
    </div>
</div>

<?php if(have_rows('technical_information')) : ?>
    <div class="detail__information">
        <div class="detail--contain">
            <div class="detail__content">
                <div class="detail__heading">Technical Information</div>
                <table class="detail__table">
                    <thead>
                    <tr>
                        <th>Material</th>
                        <th>Grades</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php while( have_rows('technical_information') ): the_row();
                        // vars
                        $material = get_sub_field('material');
                        $grades = get_sub_field('grades');
                        ?>
                        <tr>
                            <td><?=$material;?></td>
                            <td><?=$grades;?></td>
                        </tr>

                    <?php endwhile; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
<?php endif; ?>
Krupal Panchal
  • 1,553
  • 2
  • 13
  • 26
Dan Reeves
  • 11
  • 4

0 Answers0