Skip Navigation

[Resolved] Tool set view return all post when parent relation in empty

This support ticket is created 4 years, 2 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Shane 4 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1787183
view.jpg

I am trying to:I am facing an issue in view with related to relation filter. When the parent relation is empty view is showing all the post this link return parent and working fine hidden link and this link retunr parent empty hidden link shows all post

Link to a page where the issue can be seen:hidden link shows all post

I expected to see: :hidden link

Instead, I got: hidden link

#1787995

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nelson,

Thank you for getting in touch.

What you're saying is that if the child post doesn't have a parent selected then it will be returned, for e.g this page here ?
hidden link

Is the view placed directly on the parent's content template ?

I see that you are using a shortcode parameter to filter the view for child values.

Please let me know.
Thanks,
Shane

#1790067

I am getting like this hidden link when I don't have a parent relation, mean if the parent selector is empty they all post are showing. I am using this short code [wpv-view name="giveaway" gavrelatedto="[wpv-post-id item='@collection-product.parent']"]

#1790489

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nelson,

I can understand why this would be returning all the items.

Based on this setup you are passing the Parent ID of the current post into the view which i'm assuming is listing a different custom post type than the post that the view is on.

Perhaps I need to log in to get a better understanding of the setup because I will need to have a look at your relationship setup to fully understand what is happening here and the data being passed to the view.

I've enabled the private fields for your next response.

Thanks,
Shane

#1793355

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nelson,

I've used our conditional shortcode to check if the post ID for the parent is returning a value.

This allows you to only display the view if there is a parent. Here is the code that was used.

[wpv-conditional if="('[wpv-post-id item='@collection-product.parent']' ne '' )" ]

[wpv-view name="giveaway" gavrelatedto="[wpv-post-id item='@collection-product.parent']"]

[/wpv-conditional]

Please let me know if this helps.
Thanks,
Shane