Home › Forums › Add-ons › Repeater Field › Sorting a group field › Reply To: Sorting a group field
I’m not sure what changed but I decided to try some code I’d been working with previously and it has decided to work today (aggravating but I’ll take what I can get). For anyone in a similar boat, this is what I did:
<?php query_posts(array(
'post_type' => 'sponsor',
'showposts' => -1,
'meta_key' => 'child_info_child_idnum',
'orderby' => 'meta_value',
'order' => 'ASC',
'post_status' => 'publish'));
if ( have_posts() ) :?>
<ul id="spo_kids">
<?php while ( have_posts() ) : the_post();
if( have_rows('child_info') ):
?>
<ul>
<?php while( have_rows('child_info') ): the_row(); $child_image = get_sub_field('child_picture');
?>
<li>
<div>
<img src="<?php echo esc_url( $child_image['url'] ); ?>" alt="<?php echo esc_attr( $child_image['alt'] ); ?>" />
<?php echo '<h5>';
echo the_title();
echo '</h5>';
echo '<span class="c-dob">';
echo 'DOB: ';
if ( get_sub_field('birthday') ):
echo the_sub_field('birthday');
else: echo 'Unknown'; endif;
echo '</span>';
if ( get_sub_field('date_verified') ):
echo '<span class="c-verified">';
echo 'Verified: ';
echo the_sub_field('date_verified');
echo '</span>';
else: endif;
?>
<a class="spo-links" href="<?php the_permalink(); ?>#spo_form" />
<?php if ( get_sub_field('currently_sponsored') == 'Special Need' ): ?>
Special Need
<?php else: ?>
Sponsor Now
<?php endif; ?>
</a>
<a class="spo-links" href="<?php the_permalink(); ?>" />Learn More</a>
</div>
</li>
<?php endwhile; ?>
</ul>
<?php endif; endwhile; endif; ?>
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.