Home › Forums › Add-ons › Repeater Field › 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: </strong><?php the_sub_field('price'); ?>
</div><!--leftcol-->
<div class="mid_col"><strong> Bedroom: </strong> <?php the_sub_field('bedrooms'); ?><br/>
<strong>Baths: </strong> <?php the_sub_field('baths'); ?><br/>
<strong>Car Storage: </strong><?php the_sub_field('car_storage'); ?><br/>
<strong>Heat: </strong><?php the_sub_field('heat'); ?><br/>
<strong>Style: </strong><?php the_sub_field('style'); ?><br/>
<strong>Total Sq Ft: </strong><?php the_sub_field('total_sq_ft'); ?><br/>
<strong>HOA Named: </strong><?php the_sub_field('hoa_name'); ?><br/>
<strong>HOA Quoted: </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: </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
The topic ‘Sort Field Group's sub fields’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.