I want to create a loop with section titles, to be displayed within a post relationship setup. Here is how I thought this could be done:
1. Parent post in a many-to-many relationship with child posts
2. View displays the related child posts within the parent post
3. Each child post has a Relationship custom text field 'section title'
4. The child post content template starts with a conditional which displays the 'section title' field only if it is different than the 'section title' of the previous post in the loop.
Is such a conditional possible?
Hello and thank you for contacting the Toolset support.
If I understand well your request, you are looking to group the view's results by that custom field value. Only display it for the first post, then do not display it until it changes in the current post of the loop, right?
If yes, we have an article about it here, the trick is to order the view's results by that custom field https://toolset.com/2013/10/how-to-group-views-results-by-year-and-month/
If no, I hope that the custom code in the article inspires you to come up with a solution. Otherwise, please give me a concrete example to help me understand your use case, and I'll do my best to help you with it.
Thanks for the link! I'll work it out 🙂