I have a Post Type called, eg. Food (parent to Types of Food)
I then have another post type called Types of Food (children to Food)
There share the same taxonomy. Lets call it category.
I use a view to display the Food post type in a list.
I want to have the ability to click a Food item in the list.
On click this should then show all the child posts (Types of Food) as a list where the category term is the same.
I want to have the ability to click a Types of Food item in the list.
On click, this should display the body content of the Types of Food item I have clicked.
This should all be on the same page. Three columns type of thing.
Click list item in column 1 = list of items appears in column 2
Click list item in column 2 = body content appears in column 3
Post type: Food(PT) --------Types of Food(PT) ------ Body content (of Types of Food PT)
Relationship: parent------------child-----------------content of child
Display: list ----------------------list-------------------one at a time text
I need to prevent multiple http requests when a users is clicking about, I would presume some JS would be used to make this happen.
Hello,
I suggest you setup a nested view, for example:
1) Parent post view, query "Food" posts, in the view's loop, display below child view
2) Child post view, query "Types of Food" posts, 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 the post content
hidden link
3) For the click function, please try to setup some custom JS codes, for example, jquery toggle:
hidden link
To setup the custom JS codes, please check our document:
https://toolset.com/documentation/user-guides/adding-custom-javascript-views/