I'm working on a site with a structure I haven't seen in the past. Specifically, the site has Inventory Items (custom post type 'item') that show on Item Archive and Item Single pages. For some of these 'Items', we will input a matching ACF Field (Auction ID) to associate them with each other.. eg. the items with the same Auction ID will not only show individually in inventory but will also show on an Auction Custom Post Type page (single). We'll also show a list of these Auctions on an Archive page.
So, here's the question. What would you WP Gurus recommend to structure this cleanly:
Use Custom Post types (as I've began setting up) and code individual archive-item, single-item, archive-auction and single-action pages to display the loops. And use an ACF field on the Items, that I can call in the loop to just display those that have the matching ACF field (Auction ID)?
Use Custom Post types with categories or another structural WP option?
Since we're not using any typical auction features (the auctions are head off site through an auction provider, these pages are just for representation and to link to that site), and we don't need ecommerce features, we prefer not to use an auction plugin, etc. and to just roll this from WP core. But, after digging into a mess we had to fix from a previous developer.. my head it just reeling. Just can't wrap my head around the best way to structure these content items.
Recap: Inventory Items are posted to the site (displayed on single-item.php templates) Some items will be associated (likely with an ACF Field) There are Auction posts on the site - with descriptions and additional event data as well as a display of Inventory Items that have matching ACF field data. Auctions have both archive-auction.php (for listing all auctions) and single-auction.php to show the individual auction post.
ALL Inventory Items will remain on the site, even after being sold (just displayed as 'sold'). This STATUS has not been configured yet. What is the easiest to loop with - ACF field? Taxonomy? Category?
Auctions will expire at a preset time (ACF Date Field in the Custom Post Type currently)
Really appreciate any suggestions or advice!
Here's my current loop:
` <?php $today = date("Ymd"); $loop = new WP_Query( array( 'post_type' => 'auction', 'posts_per_page' => 5, 'meta_key' => 'auction_date', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array( // WordPress has all the results, now, return only the events after today's date array( 'key' => 'auction_date', // Check the start date field 'value' => $today, // Set today's date (note the similar format) 'compare' => '>=', // Return the ones equal or greater than today's date 'type' => 'DATE' // Let WordPress know we're working with date ) ) /* , 'tax_query' => array( // Return only concerts (event-types) and events where "songs-of-ascent" is performing array( 'taxonomy' => 'status', 'field' => 'slug', 'terms' => 'available', ), ) */ ) ); if ( $loop->have_posts() ): get_template_part( 'template-parts/content', 'auctions' ); else : get_template_part( 'template-parts/content', 'none' ); endif; wp_reset_postdata(); ?>