Skip Navigation

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

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 6 Jahren, 5 Monaten. 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)

Dieses Thema enthält 4 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von marcialB vor 6 Jahren, 5 Monaten.

Assistiert von: Nigel.

Author
Artikel
#915609

Hi there

We have a view that displays search results of different courses: versteckter 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

Sprachen: Englisch (English ) Spanisch (Español )

Zeitzone: 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

Sprachen: Englisch (English ) Spanisch (Español )

Zeitzone: 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