I am trying to work on relationships. I have few queries regarding the same,
When I am creating Many to many relationships in and while creating a template for the Custom Post type in the Field Source, I am not able to select the other CPT while this is not the case when I am creating One to many relationships.
If you are editing the template for the many-part of a one-to-many relationship you can choose to show fields from the one-part of the relationship directly (e.g. to show fields from a parent post in the child template), and you can do this because there is only one post that you are referring to.
Whenever you want to show a field from the many-part of the relationship (e.g. you want to show a field from child posts, or from posts connected via a many-to-many relationship), the problem is that there are many possible posts the field value could come from, not just one.
In that case you must display such field values indirectly, using a View, which will loop over the many posts (e.g. all of the child posts) and output the field for each one.
Thanks for the reply, in that case when I am creating Views then I am not able to make a view for one-to-many post where I can list all related post for single related post
Hello,
For the question:
I am not able to make a view for one-to-many post where I can list all related post for single related post
It is not clear, are we talking about one-to-many or many-to-many relationship.
If it is many-to-many relationship, you need to create a post view:
- Query posts of related post type
- Filter by the many-to-many relationship
- In view's loop, display the related post information