Sauter la navigation

[Résolu] sibling in view

This support ticket is created Il y a 4 années et 8 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Ce sujet contient 1 réponse, a 2 voix.

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

Assisté par: Waqar.

Auteur
Publications
#1661201

Tell us what you are trying to do? display sibling of parent through child ID

Is there any documentation that you are following? no

Is there a similar example that we can see? no

What is the link to your site? lien caché
the relationships are
one >many: projects>tasks
and
one>many projects>worksample

my view displays all tasks into a table, and displays the parent by pulling @project-task.parent
how do i pull the worksample related to the project?

#1662689

Hi,

Thank you for contacting us and I'd be happy to assist.

To display "worksample" posts related to a "project" post, you'll need a new post view, with post-relationship filter:

1. Please create a new view and set it to show "worksample" posts.

2. In the "Query Filter" section, you'll add a post-relationship filter for the "projects>worksample" relationship and for the related item source select the option "The post with ID set by the shortcode attribute: wpvrelatedto".
( example screenshot: lien caché )

3. You'll need the target "project" post's ID which can be acquired using the item attribute in "wpv-post-id" shortcode:


[wpv-post-id item='@project-task.parent']

4. The last step would be passing this project ID in your newly created view's shortcode, where you'd like to display these related "worksample" posts:


[wpv-view name="view-name" wpvrelatedto="[wpv-post-id item='@project-task.parent']"]

Note: you'll replace "view-name" with this newly created view's name or slug.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar