Post relation templates
Post relations are one the premium features of ACPT plugin.
From v1.0.80 is finally possible to create and manage the releated posts templates in a very simple way.
Create the related template
To set up a related template go to main ACPT dashboard and locate the related template column:
Click on the Create button. The template builder opens.
As you can see the base layout is pretty identical to the single archive.
Work as usual and build the template (please refer to the template builder documentation), once you are done click on save.
Now you have created a reusable view and you are ready to use it in other post templates.
Let's consider the previously given example. Suppose you have two custom post types: one called Florist and one called Flower.
The Florist may have many flowers, and any flower belongs to only one Florist.
As usual, create a field called flowers on Florist and a field called florist on the Flower (create them as simple text) and then, go to Florist and transform the flowers fields in a One to many bidirectional relations: select Flower as post type and florist as field target.
Automatically on the Flower side, the florist field is now a Many to one bidirectional relation.
Now go to the main ACPT dashboard and create a Related post template for flower CPT.
Once you're done, return back to florist single template.
Here you can finally add the
flowers field, drag it to the editor and set the number of element per row:
Done! Click on the preview link to see the final result!