Support

Account

Home Forums Add-ons Repeater Field Sort Field Group's sub fields

Helping

Sort Field Group's sub fields

  • Hi,

    First what a great plugin! Saves me hours of work.

    I am using a field group with repeater sub fields. I need to sort by the sub field group.

    I am not seeing an easy way to do this, is there and id added to the group subfields that I can use for an array to change the sort order?

    below is my code so far:

    
    <div class="section_wrap">	
            <?php while(has_sub_field('featured_property')){ ?>         
    				<h1 class="property"><?php the_sub_field('property_address'); ?></h1>
    
            		
                    <div class="left_col">
            			<img src="<?php the_sub_field('property_image'); ?>" alt=""/>
                       
            			<strong>Price:&nbsp;&nbsp;</strong><?php the_sub_field('price'); ?>
                    </div><!--leftcol-->
          			<div class="mid_col"><strong> Bedroom:&nbsp;&nbsp;</strong> <?php the_sub_field('bedrooms'); ?><br/>
            					<strong>Baths:&nbsp;&nbsp;</strong> <?php the_sub_field('baths'); ?><br/>
            					<strong>Car Storage:&nbsp;&nbsp;</strong><?php the_sub_field('car_storage'); ?><br/>
            					<strong>Heat:&nbsp;&nbsp;</strong><?php the_sub_field('heat'); ?><br/>
            					<strong>Style:&nbsp;&nbsp;</strong><?php the_sub_field('style'); ?><br/>
            					<strong>Total Sq Ft:&nbsp;&nbsp;</strong><?php the_sub_field('total_sq_ft'); ?><br/>
           						<strong>HOA Named:&nbsp;&nbsp;</strong><?php the_sub_field('hoa_name'); ?><br/>
            					<strong>HOA Quoted:&nbsp;&nbsp;</strong><?php the_sub_field('hoa_quoted'); ?>
                                <?php if( get_sub_field('website_address')): ?>
    							<strong>Website Address:</strong><br/><?php the_sub_field('website_address'); ?>
    
    							<?php endif; ?>
    				</div><!--mid col-->
    				<div class="right_col"><strong>Additional Features:&nbsp;&nbsp;</strong> 
                     <?php the_sub_field('additional_features'); ?>
    				 
                    </div><!--rightcol-->
    
    <?php 
    $value = get_sub_field('sold_image');
    if( $value == 1 )
    {
     echo '<div class="sold"></div>';
    }
    else
    {
     
    }
    ?> <?php } ?>
          </div><!--section_wrap-->

    Also I want to have the latest entry when I add a row to be added at the top on the back end so my client doesn’t have to scroll to the bottom of the page to add a new group of data. Am I just missing a toggle somewhere that can show the latest first?

    Thank you in advance for your help…

  • Hi @dillig

    When editing the data, please use the “+” button which is on the top right of the row (when hovering on a row) to add a new row above the current position. This is how you can add a new row to the top.

    You can sort the repeater field data by following this documentation article:
    http://www.advancedcustomfields.com/resources/how-to/how-to-sorting-a-repeater-field/

    Thanks
    E

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

The topic ‘Sort Field Group's sub fields’ is closed to new replies.