So I set up an ACF field called “region” in which the backend user can select the region for each sports league that they input (Southwest, North, SouthEast, etc.) “Region” is part of a field group with other fields with information such as the league’s address and contact information.
Is there any way to display say, only the information from the field group in a certain div or list if a particular region is selected (i.e. Southwest)?
In other words, I’m really trying to filter and organize the lists based on region. It also has to be part of the WordPress loop.
I tried the following and it didn’t work (it’s obviously totally wrong, but it’s to show that I did try my best…):
$args = array(
'post_type' => 'leagues',
'post_status' => 'publish',
'posts_per_page' => '3'
$tournaments_loop = new WP_Query( $args );
if ( $tournaments_loop->have_posts() ) :
while ( $tournaments_loop->have_posts() ) : $tournaments_loop->the_post();
// Set variables
$title = get_the_title();
$state = get_field('league_state');
$option = get_field("league_region");
// display field;
// don't display
<td><?php echo $state; ?></td> <td><?php echo $title; ?></td>