Crocoblock Related Posts
Short Answer
How to insert related posts in your templates
String: %related_parents_from|YOUR-CPT-SLUG% or %related_CHILDREN_from|YOUR-CPT-SLUG%
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.
