How To Link Post Types?
Divi Machine enables you to link two post types together. There are two ways of linking post types outlined below. Note that linking post types is very different to showing related posts. For more information on related posts please click HERE and read. Remember to update or publish your work as you go. Follow the images below.
FIRST WAY OF LINKING POST TYPES.
The first way of linking post types takes the archive page template of one post type and displays assigned posts of a second post type. For example, the Dealers archive page template will display posts from the Cars post type.
1.) Create Two Post Types.
Create two post types and assign one (in your mind) to be the first and the other to be the second. For example, Cars (first post type) and Dealers (second post type).
2.) Link Your Post Types.
Go to the ACF Field Group of your first post type and create a Post Object custom field named after the second post type. Make sure that you add the post type of this field to the Filter by Post Type section. For example, I create a Post Object custom field in the Cars Field Group called Dealers and assign the Dealers to the Filter by Post Types. After doing this you must go to the posts of the first post type and add in the information for this new field. For example, I go to each of my cars and choose which dealer each car is currently stationed at.
3.) Build An Archive Page.
Build an archive page for the second post type in the Theme Builder and add to this template the .ARCHIVE LOOP Module. Make sure that the Main Options has the first post type as the Post Type. For example, Cars. Then go to the Loop Options section and change the Post Display Type to be Linked Post and then select the Linked Post Object ACF Name that you have created in the first Post Type Field Group. Now when you view the second post type posts you will see the posts linked to the first post type. For example, each page for my Dealers will show a loop of cars associated with that dealer.
SECOND WAY OF LINKING POST TYPES.
The second way of linking post types takes the single page template of one post type and displays information of a second post type. For example, the Cars single post template can display information from the Dealers post type.
1.) Follow Steps From Above.
Follow steps 1 and 2 above.
2.) Build A Custom Loop Layout.
Make your way to the Divi Library and create a loop layout for the second post type. Make sure that in this loop layout, you add ACF Items that are assigned to the linked post type and not to the current post type. For example, I would make a Dealers Loop Layout and add the ACF Items that are assigned to the Dealers post type and NOT Cars post type. Add modules like the .POST TITLE and .THUMBNAIL.
3.) Build A Single Post Template.
Go to the theme builder layout for the single page of your first post type and add an ACF item module. Choose the ACF item created above. Under the Relational Field Settings tab choose the custom layout you created in the second step directly above this. You can also choose a grid system if you have more than one post type selected. For example, I would choose Dealers Layout Loop (Dealers LL).