Skip Navigation

[Resolved] View to display sibling posts not working

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

Problem:
How to display related child post when post type is set to support hierarchical post structure where you set parent and child posts from same post type.

Solution:
You should query your view by post ID and set the query filter to filter post by shortcode attribute and pass the parent post ID as view's shortcode attribute to filter related post that belongs to same post type in hierarchical structure.

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/view-to-display-sibling-posts-not-working/#post-739650

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/
=> https://toolset.com/documentation/user-guides/passing-arguments-to-views/

This support ticket is created 6 years, 6 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by AtefR7377 6 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#739225

Hi,
I have a CPT called "sermons", where some sermons are combined into series, and some are just individual sermons.

Therefore, I built and advanced layout that displays the sermons field when it is a single sermon, while displays a view showing the series when it is a series. this is done using conditionals and checkboxs.

the series is defined by a tag. so the series parts will have the same tag, and the view is based on the tag.

All is working perfectly fine.

now i wanted to display a section in the layout that shows info about the series.
so the post is a part of a series, i want to show:
1- a sentence saying: this sermon is part of the series: [parent post title with link]
2- a view showing the post title with link of the other parts in the series.

I was able to achieve #1 easily using the Toolset documentation.

but for #2, I followed the tutorial in this page:
https://toolset.com/documentation/user-guides/displaying-brother-pages/

but i end with "no items found"

please check this post:
hidden link

the fact that #1 shows (under the youtube video), means that the parent-child relationship works.

what i did is:
- created a content template called: Series Loop
- created a view called: Series List of Children
- added this to the template:

[wpv-view name="series-list-of-children"]

- in the series of children, i used the filter: Select posts whose parent is the current post in the loop.
- then in the sermons CPT i added

[wpv-post-body view_template="series-loop"]

but i end up with no items found.

can you please advise what information you need to spot the problem?

thanks

#739502

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - are you filtering your view with any filter options - is it possible for you to send me access details so that I can check your current setup and guide you in right direction.

Additionally - which posts should be shown within the view instead of "no items found" message.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#739607

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately - wp-admin access details you shared is not working at this end. Could you please send me working wp-admin access details.

I have set the next reply to private which means only you and I have access to it.

#739608

Hi Minesh,

Very sorry about this.
I fixed this issue and the credentials I sent in the previous private message are now valid. please try again.
the login screen is in Arabic, but just copy and pasted the lonig details and you will have an admin access to the site, in English.
thanks

#739650

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see you are using hierarchical post structure where you set parent and child posts.

I've changed your view's query filter and set to filter by view's shortcode attribute as given under:

[wpv-view name="series-list-of-children" wpvchildof="[wpv-post-id id='$parent']"] 

I've changed the Query filter to:

 المرشح الرئيسي للمنشور
Select posts that are children of the Post with ID set by the shortcode attribute wpvchildof.
eg. [wpv-view name="view-name" wpvchildof="123"]

Now - if you can visit the post: hidden link

I can see the another post - could you please confirm.

#739767

Thanks Minesh for such a quick and efficient solution. very much appreciated.