Hi there,
I have two custom post types: Contributors and Resources. They are in a many-to-many relationship. When I connect multiple Contributors to a given Resource, is there a way that I can ensure the order of the Contributors? To be less abstract, let's say I have an article that's been written by two people, Jane Brown and John Smith. Jane is the primary author and John is the secondary author, and I need to ensure that Jane's name precedes John's. Does that make sense?
Thank you!
Saul
Dear Saul,
Yes, it is possible to customize the order of related posts.
For example, you can try these:
1) Create a many-to-many relationship between post types Contributors and Resources,
- in step "Relationship fields", add a custom numeric field "sort-order".
- in step "Names", enable option "Intermediary Post Type visible in WordPress admin menu".
in section "Intermediary Post Type and Custom Fields", add a custom numeric field "sort-order".
2) Edit each "Resources" post, related with some "Contributors" posts, setup the "sort-order" field values
3) In single "Resources" post, setup a post view:
- Query the posts of post type "Resources Contributors Intermediary Posts",
- Order the result by field "sort-order"
- Filter by the post type relationship:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items
- In view's loop, display it's related Contributors information
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-one-related-item-parent