You have created your cpts and added a relation between them? Now you would like to show the related posts in a template?
It seems very difficult in the beginning, but when you understand Crocoblock’s logic behind it, it gets very simple ;)
Let’s say you have this situation:
CPT CARS
CPT DEALERS
RELATIONSHIP: ONE TO MANY – PARENT: DEALERS – CHILD: CARS
After having created your LISTINGS both for CARS and DEALERS, create your template for CARS and you would want to add the DEALERS that have this car, here are the steps:
add the listing widget
call the LISTING “DEALERS” that you created earlier
under the post query options, choose post&author parameters in the field “Include posts by IDs” add this string: %related_parents_from|cars%
If the above is still not clear for you, Paul Charlton from WPTUTS has a great tutorial explaining exactly how it’s done.
B.Wired di Bersier Benoit Jonathan © 2019 All Rights Reserved
Questo sito fa uso di cookie per migliorare l’esperienza di navigazione degli utenti. Può conoscere i dettagli consultando la nostra privacy policy qui. Proseguendo nella navigazione si accetta l’uso dei cookie; in caso contrario è possibile abbandonare il sito.