I have created a while loop in WordPress where by it outputs some custom field and post data. What I want to do is look inside the loop and check to find if a field matches to highlight the field and also output its position from the iteration.
My users have a field in their profile called 'schoolname' which I wan to reference against.
$user_info = get_userdata(1);
echo $user_info->schoolname;
$i= 1;
$loop = new WP_Query(
array( 'post_type' => 'schools',
'posts_per_page' => -1,
'orderby' => 'signups',
'order' => 'ASC', )
);
while ( $loop->have_posts() ) : $loop->the_post();
echo '<tr>
<td>' . $i++ . '</td>
<td>' . get_the_title() . '</td>
<td>' . $signups = get_field( "signups") . ' Signups</td>
</tr>';
endwhile; wp_reset_query();