Support

Account

Home Forums Add-ons Flexible Content Field Reorder Flexible Content Rows in another page Reply To: Reorder Flexible Content Rows in another page

  • The simplest way to do this would be to add the same field group to the admin of this other page and enter the content there.

    Alternately, you could store the first row in an object buffer and then output in after the second one, however, what will you do if the order is changed on the other page?

    
    <?php 
    
    $buffer = '';
    if( have_rows('contact', $page_id) ): while ( have_rows('contact', $page_id) ) : the_row(); ?>
    
      <?php if( get_row_layout() == 'email' ): ?>
          <?php ob_start(); ?>
          <a href="mailto:<?php the_sub_field('email'); ?>"><?php the_sub_field('email'); ?></a>
          <?php $buffer = ob_get_clean(); ?>
      <?php elseif ( get_row_layout() == 'text' ): ?>
    
               <span class="aadress"><?php the_sub_field('text'); ?></span>
          <?php 
            if ($buffer) {
              echo $buffer;
              $buffer = '';
            }
          ?>
      <?php endif; ?>
    
    <?php endwhile; endif; ?>