Skip Navigation

[Resolved] Filtrar View por páginas jerárquicas

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a one-to-many post relationship set up between two post types. On the parent post, I would like to display a View of child posts. On the child post, I would like to display a View of sibling posts.

Solution: On the parent post template, insert a View of the child post type. Add a Query Filter for post relationship, set by the post where the View is shown. In the child post type template, insert a View of the child post type. Add a post relationship Query Filter set by a shortcode attribute "wpvrelatedto". In the View shortcode, pass in the current post's parent post ID using the following format:

[wpv-view name="Your Child View Number 2" wpvrelatedto="[wpv-post-id item='@relationship-slug.parent']"]
This support ticket is created 3 years, 9 months ago. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Rafael Corts 3 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1715767

View 1.
Hola Nigel, quiero crear una View para que solo muestre las paginas hijo de una pagina padre, como se debería de hacer? que tipo de filtro se utiliza?
Cuando estes en una pagina padre y tenga paginas hijo, aparezcan en un listado.

View 2.
Y otro View que necesito es crear un filtro en otra View que cuando estes en una pagina hijo aparezca el listado de las otras paginas que cuelguen del mismo padre.
No se si se entiende.
Saludos.
Rafa Corts

#1716217

Hello, our Spanish language support team members are unavailable at this time. I will be glad to provide support in English if you would like to receive English support here.

#1716349

Hi Christian,
I want to create two kinds of Views:
a view that only shows the son page ( how do I have to do it?What kind of filtre is it used?)
example:
pagina-1.com
pagina-1.com/ejemplo-1/
pagina-1.com/ejemplo-2/
pagina-1.com/ejemplo-3/
pagina-2.com/ejemplo-1/
pagina-3.com
Filter:
pagina-1.com/ejemplo-1/
pagina-1.com/ejemplo-2/
pagina-1.com/ejemplo-3/

Another view that from a son’s page that shows the other pages from the same father. I don’t know if I’m explaining correctly...
example:
pagina-1.com/ejemplo-1/
Filter:
pagina-1.com/ejemplo-2/
pagina-1.com/ejemplo-3/

Thankyou very much.
Rafa Corts

#1716567
query-filter-2.png
query-filter-1.png

a view that only shows the son page
On the parent post page, you want to show a View of child posts. Okay you must create a View of child posts with a post relationship Query Filter, where the parent post is set by the post where the View is displayed. In Spanish, "La entrada donde se muestra esta view". See the screenshot query-filter-1.png for an example in Spanish.

Another view that from a son’s page that shows the other pages from the same father.
On the child post page, you want to show a View of sibling child posts. Okay you must create a View of child posts with a post relationship Query Filter where the parent post is set by a shortcode attribute "wpvrelatedto". See query-filter-2.png for an example in Spanish. Be sure "No incluir página actual en resultado de consulta" is checked.

When you insert the View shortcode in your child post template, you must include the post ID of the parent post using the wpv-post-id shortcode, using the "item" attribute and the post relationship slug. For example:

[wpv-view name="Your Child View Number 2" wpvrelatedto="[wpv-post-id item='@relationship-slug.parent']"]

Replace "Your Child View Number 2" with the name of your second View. Replace relationship-slug with the parent-child post relationship slug. You can find the slug in Toolset > Relationships when you edit the post relationship. This should produce a list of sibling posts.

Let me know if you have questions about these two Views.

#1720789

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.