Project research.
I have been asked if I can help a local children’s sports club to setup a system on their website to publish a schedule of matches and display it in a grid. I have started experimenting with custom post types but I’m not sure if I am going down the wrong path. I currently have a custom post type for matches and a custom post type for teams. They would like a grid as follows that will be updated from the custom post types but I am searching for the best way to do this.
U10 team U11 Team U12 team U13 team U14 team
30/05/2025 away home away away away
31/05/2025 home home away
01/06/2025 home away home
02/06/2025 away away home
20/06/2025 away
My sandbox is setup so the user adds a match and selects a date form a date picker for the match date but I will need to setup a looper to do something like a SELECT DISTINCT in sql
The match CPT is also linked to the Teams CPT using ACF pro relationship filed
I have been wondering if match date should actually be a custom taxonomy so each match date will need to be added to a match date taxonomy before a user can add a match to that day.
Any thoughts on this are much appreciated.
I did query this with Claude and it came back with the following and most notably that a match date taxonomy is a bad idea!!! I thought i would post this a people are interested in how AI is responding
CPT + ACF Relationship — You’re on the right track
Using a Match CPT linked to a Teams CPT via an ACF relationship field is a solid foundation. Don’t abandon that path.
The Taxonomy Question for Match Dates
This is the most interesting architectural decision. Here’s the honest breakdown:
Using a custom taxonomy for dates — probably not ideal, for a few reasons:
• Dates are inherently a data type, not a classification. Taxonomies are designed for things like “category” or “location”, not calendar dates
• You’d end up with a messy growing list of taxonomy terms like 30-05-2025, 31-05-2025 etc.
• Querying and sorting them chronologically becomes awkward since taxonomy terms are alphabetical by default
• Adding a new match date means an admin has to first create the taxonomy term, which adds friction and room for error
Stick with a date picker field (ACF date field) — this is the right call because:
• Dates sort and filter naturally in WP_Query using meta_query and orderby => meta_value
• No pre-administration needed before adding a match
• Your SELECT DISTINCT equivalent is achievable via a custom query
The DISTINCT Date Problem in WordPress
This is where it gets interesting. You have a few options:
Option 1 — Custom SQL query (most direct)
php
global $wpdb;
$dates = $wpdb->get_col("
SELECT DISTINCT meta_value
FROM {$wpdb->postmeta}
WHERE meta_key = ‘match_date’
ORDER BY meta_value ASC
");
This gives you your unique dates to loop over as the row headers in your grid.
Option 2 — WP_Query with grouping in Twig/PHP Run a query for all matches, then group the results by date in PHP/Twig before rendering. Less efficient but keeps you within standard WP_Query.
The Grid Logic
The grid you’ve described is essentially a pivot table — dates on one axis, teams on the other. That’s hard to do purely with a standard looper. The approach I’d suggest:
- Get your distinct dates (the rows)
- Get all your teams (the columns) — from your Teams CPT
- For each date, loop through each team and check if a match exists for that combination, and if so whether it’s home or away
In pseudo-code:
for each date:
for each team:
find match where match_date = date AND related_team = team
output “home” / “away” / empty cell
Cornerstone / Twig Consideration
The pivot table logic is complex enough that a pure looper stack in Cornerstone will struggle with this. I’d suggest:
• Build a custom PHP function (in your theme’s functions.php or a plugin) that returns the fully structured grid data as a nested array
• Expose it to Twig via a Timber filter or a custom shortcode/block
• Then your Cornerstone template just renders what PHP has already structured
This keeps the heavy logic out of the builder and makes the template clean and maintainable.
Summary Recommendation
Decision Recommendation
Match date field type ACF Date Picker (not taxonomy)
Team linking ACF Relationship (keep as-is)
Distinct dates Custom SQL or PHP grouping
Grid rendering PHP builds the data structure, Twig renders it
Looper use Fine for simpler lists, but the pivot grid needs custom code