Skip Navigation

[Résolu] Filter children by grandparent

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I have a 3-level custom post type relationship hierarchy - grandparent > parent > child. On my single grandparent post page, I would like to display a View of child posts, with a custom search filtered by parent. By default, all the children of the current grandparent should be displayed, and the user should be able to select a parent as a filter.

Solution: There are two options: use a URL parameter and a post relationship filter, or use two nested Views.

URL parameter approach: Create a View that shows child posts, filtered by Post Relationship (grandparent > parent). Set the filter query to respond to a URL parameter. Apply this URL parameter to all links to the grandparent single post page:
http://yoursite.com/state/washington?wpv-post-relationship-state=57273

Nested View approach: Create a View that shows child posts, filtered by post relationship, where the parent is the current post in the Loop. In the Loop Output, add the information you want to display about each child post. Then, create a View that shows parent posts, where all parents are children of the current grandparent post. Insert the child View into the Loop Output of the parent View.

Relevant Documentation: https://toolset.com/documentation/user-guides/creating-post-type-relationships/

This support ticket is created Il y a 6 années et 9 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 15 réponses, a 2 voix.

Dernière mise à jour par Jeffrey Il y a 6 années et 8 mois.

Assisté par: Christian Cox.

Auteur
Publications
#565450

Hi Christian, Thank you so much for your help, I chose the second option. it works fine now 🙂

Ce ticket est maintenant fermé. Si vous êtes un client de Toolset et que vous avez besoin d'aide, veuillez ouvrir un nouveau ticket d'assistance