Tell us what you are trying to do?
So, I have create a new custom post type called 'dog breeds' I have successfully created all the breeds that I want. And now I am making a second custom post type called 'dogs for sale'
I want people to register for my site, and then upload their own 'dogs for sale' posts...
I am wondering what is the best way to link Breeds and DOGS for sale... I want my content template for dog breeds to display a slider or post loop at the bottom of the relevant dogs for sale, JUST FOR THAT BREED.
The person who makes the submission can select from a drop down list of breeds to register that dog against, thus linking the two post types.
Can you help please?
Here is an example:
hidden link
What is the link to your site?
hidden link
Hi, if a dog for sale can only belong to one breed, then a parent / child relationship between breeds and dogs is logical. However, if a dog can belong to multiple breeds, then you cannot use a parent / child relationship because a child can only belong to one parent in any single post type. There are other options in that case, like using a taxonomy or using a many-to-many relationship.
I want my content template for dog breeds to display a slider or post loop at the bottom of the relevant dogs for sale, JUST FOR THAT BREED.
No problem. If you use a parent / child post relationship as discussed above, then you can create a View of Dogs for Sale, filtered by post relationship, where the parent post is the page where the View is placed. This will loop over all Dogs for Sale that are child posts of the current Breed. Insert that View in your Content Template for Breeds to have it appear on each Breed page.
Thanks for your help thats just what i needed
Hi, sorry can you explain. Which will be the parent and which the child? The breed the parent and then all children are the dogs for sale under that breed?
How can I use a front end form to allow people to automatically give their dog for sale the right parent?
Thanks
Hi, sorry can you explain. Which will be the parent and which the child? The breed the parent and then all children are the dogs for sale under that breed?
Breed will be the parent and Dog will be the child, because a Breed can include multiple Dogs but a Dog can only belong to one Breed.
How can I use a front end form to allow people to automatically give their dog for sale the right parent?
Here's a document that describes how to create child post forms:
https://toolset.com/documentation/user-guides/cred-forms-for-child-content/
The document also describes how to use a CRED Child Post Link to automatically set the correct parent post.