I am looking for the most efficient way to create two separate custom post types called "venues" and "offers". The role of such would be to display on a website it in the following way:
VENUE_1
- offer A
- offer B
- etc
VENUE_2
- offer C
As you see, the venues will be quite static, once added photos and descriptions will remain the same. The most dynamic thing are offers. They will vary from each other. I know I can handle that through ACF repeater in a single CPT but I don't want to use this solution due to a few technical requirements.
Is there any way that Wordpress (or Wordpress ACF) will allow to do that? From the flow pov it will look like that:
- an editor adds venue, with descriptions, photos etc through venue CPT
- along the time an editor adds specific offers through offers CPT, selecting via e.g. dropdown to which venue it is connected
I have never used relationship fields in ACF but afaik while selecting I need to do it fully manually and select very specific offer. And as said, I want to handle later on only offers, avoiding situation when constantly I need to add manually those via venue item.
CodePudding user response:
You're probably over complicating things.
You should approach it from a taxonomy point of view, meaning,
venue
as a taxonomy, offer
as a custom post type.
You can use taxonomy-<my-taxonomy>.php
to create a specific template for your custom taxonomy. eg: taxonomy-venue.php
.
You will be able to access your venue through the following permalink example.com/venue/my-awsome-venue
On each venue
taxonomy pages you will a custom query to loop through each offer
which are listed under the currently queried venue.
You should read Template Hierarchy from the codex, to have a better understanding of templating.