Linking different Custom Post Types
You can link different Custom Post Types to each other, for example:
- all events at a venue
- all doctors in a hospital
- jobs to a business
- Create the two Custom Post Types you want to link, for example Events and Venues.
- The Events will be added to the Venue in our example. To enable that, go to Events > Settings > Custom Fields tab and click on Link Posts: Venue on the left hand side to add the custom field to the list on the right hand side.
- Open the custom field and edit as required:
- Open the Advanced Settings and choose if a new Event can be added to Venues of other users, or if Events can only be added to Venues that are owned by the same user:
- Users will now be able to search for Venues and connect the Events to the Venue selected, when they add an Event using the Add Listing form:
There are different options to link the Events to the Venue on the frontend.
Use the GD > Linked Posts element, which can be used as a shortcode, widget or block.
Below is one example how to show the Events on the Venue page, and the Venue on the Events pages.
Add a tab to the Venue Detail page
- Add a linked-from-gd-event shortcode field as a tab at Venues > Settings > Tabs tab (adjust for your Custom Post Types), and edit as required:
- This is how it will look on the Detail page for the Venue:
Add a tab to the Events Detail pages
- Add a linked-to-gd-place shortcode field as a tab at Events > Settings > Tabs tab (adjust for your Custom Post Types), and edit as required:
- This is how it will look on the Event's Detail page: