I am displaying a set of upcoming fixtures for two cricket teams on the same page. The fixtures are created from a CPT and the relevant team is selected from a custom field.
I have everything working as I would want but, I have custom loops set up and the only difference between the two is one key => value
pair.
$firstXIFixtures = new WP_Query(array( 'posts_per_page' => -1, 'post_type' => 'fixture', 'orderby' => 'meta_value_num', 'meta_key' => 'date', 'order' => 'ASC', 'meta_query' => array( array( 'key' => 'team', 'compare' => '==', 'value' => '1st_XI', 'type' => 'text' ), ), ));
I only need to change 'value' => '1st_XI'
to 'value' => '2nd_XI'
in the next loop.
If it helps to give context, the fixtures are in a two column layout with separate headings above to indicate which teams the below fixtures are for.
How do I make this template file a little cleaner as it feels quite repetitive?