Skip Navigation

[Resolved] Remove duplicate parents from views loop with wpv_filter_query_post_process

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

Our next available supporter will start replying to tickets in about 1.38 hours from now. 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)

This topic contains 4 replies, has 2 voices.

Last updated by Christian Cox 6 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#516194

Hi

I have a view that loops through the child posts and displays information of their corresponding parent post information (title, links, etc).

Althought the child posts are unique, there after duplicate parents.

How can I use wpv_filter_query_post_process to filter out duplicate parents posts and only show unique parents ?

Thank you & regards

#516270

Hi, it's actually not going to be possible to filter unique parents of a child post type View using this filter. Instead, I may be able to help you implement a bit of jQuery code that can hide the duplicate parent results. If you'd like to share the URL of a page where I can see this View in action, I will take a look and try to come up with a solution for you.

#516422

Thanks for your assistance, Christian. Could you enable the private reply ? I'd like to not have the production site link visible to the public.

Thanks again

#516551

Of course, private reply enabled here.

#516602

Okay thanks, are we talking about the "Recently Booked" section? This type of View isn't a great candidate for the solution I had in mind because of the visual design. A simple list view would work well, but a grid structure is a bit too complicated. Let me explain why:

- Your design uses two rows and 4 columns to display a fixed number of results. Let's say we limit the number of results in the View to 8, but there is one duplicate we must hide. So instead of showing 8 results, now we only show 7. This makes your grid look strange, especially if the duplicate was in the top row of results. So we would programmatically need reorganize your grid and cell items to make things look "right" - four items per row. We can't fetch more items to fill the space automatically, so we would have to remove the entire second row of results. This isn't ideal.

- There's no way to programmatically know how many results we should fetch to fill up 8 unique parents. Sometimes there may be 3 duplicates, other times there may be none. So we could implement a fixed number of total results to fetch, but it's possible that there could be an incomplete result set because there are more duplicates than we expected.

We could load in a very large number of results, with the idea that we may have to remove several duplicates, but this can have some performance issues to consider. Please advise how you would like to proceed.

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