Skip Navigation

[Resolved] A post relationship filter in a View isn’t producing the right results

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

Problem:
A View contains a filter to only show related posts, but isn't working correctly.

Solution:
The filter being used was to show posts that are related to the post where this View is shown, but should have use show posts that are related to the current post in the Loop.

This support ticket is created 5 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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by marcialB 5 years, 9 months ago.

Assisted by: Nigel.

Author
Posts
#915609

Hi there

We have a view that displays search results of different courses: hidden link. Within each content template (for the search results), we have a list of mutliple elements. The first one should display the next date the course takes place. Those dates are set as a child post within each course (one-to-many). In the layout of each course, I display this date with a view that uses a query to filter out the next date. However, the same view doesn't work in the search when integrated into the content template, it displays "no items found".

I'm looking for a way to have a content template to not only display fields from a post but also search trough it's child posts and filter them with "date" is "unsigned" "greater than or equal NOW()" and only show 1 entry.

Thanks for your help.

Best,
Marcial

#915720

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

The View you are inserting into the Content Template (that returns no results) is identical to the View which you add to a Layout and works?

What is the filter you are using in the View to set the parent so that the correct child posts are queried?

#915729
toolset.JPG

Hi Nigel

Yes, it's the same. I attached a screenshot.

Best,
Marcial

#915750

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Try changing the filter from "the Post where this View is shown" to "The current post in the Loop".

You could also specify the relationship if possible rather than leaving it set to Any.

If that doesn't help then I may need to take a look at your site so I can better understand the set up, but let me know.

#915785

Hi Nigel

Thank you. Changing the filter to "The current post in the Loop" did the trick.

Best,
Marcial

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