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') ): 
    										<?php while( have_rows('child_info') ): the_row(); 								$child_image = get_sub_field('child_picture');
    																		<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 class="spo-links" href="<?php the_permalink(); ?>" />Learn More</a>
    										<?php endwhile; ?>
    <?php endif; endwhile; endif; ?>