Support

Account

Forum Replies Created

  • Still no rows, but thanks for trying. I think I have some other issues going on.

  • I tested your code, and this is what I get:

    values before first repeater
    POST: int(4)

    Active Loop: bool(false)

    Previous Loop: bool(false) values after first repeater
    POST: int(4)

    Active Loop: bool(false)

    Previous Loop: bool(false)

  • Update. Had someone else pull my code to their local copy, and it works fine. We are both working from the same database on a remote dev site.

    Still doesn’t work for me, and I am not sure we will ever know why.

  • Really strange.
    Here’s the code to begin with:
    screen1b
    The result:
    screen1a

    Now if I swap the repeaters:
    screen2b
    The result:
    screen2a
    *Note that the faqs in the second repeater also appear in the first repeater. This is not because the two repeaters are showing up together in the first example. It’s because that is the way the data is entered into the admin. Sorry to be confusing.

  • Here’s my whole section of code. The two repeaters are pretty much the same. I just refactored the second one a little and added the ‘no rows found’ echo.

    <section id="faq" class="white section6">
    <div class="container">
      <div class="row">
        <div class="col-md-12" style="padding:70px 15px 0;">
          <h3 align="center">FAQ</h3>
        </div>
      </div>
      <div class="row table-row">
        <div class="col-sm-6" style="padding:15px 15px 75px;">
          <?php if ( have_rows('faq') ) : ?>
          <?php while ( have_rows('faq') ) :
          the_row();  ?>
          <div class="faq-accordian">
            <div class="title"><?php the_sub_field('question'); ?></div>
            <div class="copy"><?php the_sub_field('answer'); ?></div>
          </div>
          <?php endwhile; ?>
          <?php endif; ?>
        </div>
        <div class="col-sm-6" style="padding:15px 15px 75px;">
          <?php if ( have_rows('faq_column_2') ) :
          while ( have_rows('faq_column_2') ) :
          the_row(); ?>
          <div class="faq_accordian">
            <div class="title"><?php the_sub_field('question_col2'); ?></div>
            <div class="copy"><?php the_sub_field('answer_col2'); ?></div>
          </div>
          <?php endwhile;
          else :
          echo ('no rows found');
          endif; ?>
        </div>
      </div>
    </div>
    </section>
  • I have two repeater fields, the second is duplicated from the first. The first one works fine, but the second one does not return any data.

    The php for the problematic repeater is as follows:

    <?php if ( have_rows('faq_column_2') ) : 
            while ( have_rows('faq_column_2') ) :
              the_row(); ?>
                <div class="faq_accordian">
                  <div class="title"><?php the_sub_field('question_col2'); ?></div>
                  <div class="copy"><?php the_sub_field('answer_col2'); ?></div>
                </div>
            <?php endwhile;
              else :
                echo ('no rows found'); 
              endif; ?>

    My field names match up as shown in this screenshot:
    acf repeater screenshot

    I have tried rewriting the code (rather than copy/paste), I deleted the ACF plugin, uploaded the latest version, edited the sub fields to have a different name, and no luck. Then I deleted the repeater field, added a new one with all new names, still no luck.

    I tried a var_dump as described by @csaborio, and it returns all my data successfully.

    The repeater, however, always returns “no rows found”. Very strange. Any ideas?

Viewing 7 posts - 1 through 7 (of 7 total)