Skip Navigation

[Resolved] Display parent post type in parametric search of child custom field

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

Problem:

In my website, there is parent post type "contatti" + child post type "corsi".
custom field "data inizio corso" in post type "corsi"

I'm trying to setup a view that allow to display "contatti" that attended to "corsi" >= "data inizio corso"

Solution:

You can try this:

1) Create a view list child "corsi" posts, filter by custom field "data inizio corso":
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

2) In the view loop, display it's parent "contatti" post information:
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/

Relevant Documentation:

https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/

This support ticket is created 6 years, 10 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by Luo Yang 6 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#606090

Hello i have:
parent post type "contatti"
child post type "corsi"
custom field "data inizio corso" in post type "corsi"

I'm trying to setup a view that allow to display "contatti" that attended to "corsi" >= "data inizio corso"

I can't manage how to do this

#606166

Dear CulturaI,

You can try this:
1) Create a view list child "corsi" posts, filter by custom field "data inizio corso":
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/
2) In the view loop, display it's parent "contatti" post information:
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/

#606196

Hello Luo thanks for response,

searching only in "corsi" and using $parent it helps a lot, i can display correct informations.

But it returns duplicate informations, for example:

"contatto" - Roberta
"corso1" - data inizio 1/2/2018
"corso2" - data inizio 1/3/2018

Parametric search
"corso data inizio" >= 1/1/2018

it returns 2 times Roberta, i need that it returns 1 only time in view

#606612

As you can see there isn't such a built-in feature within Views, if you agree, we can take it as a feature request, our developers will evaluate it.

#607343

Yes i think that it could be useful, moreover i would like to filter easily parent posts based on child repeteable parameters (i don't think that it can be done with views).

In my case for example:
parent "contatti"
child "corsi" with custom fields: "livello", "tipo di corso"

I would filter "contatti"based on "corsi" custom fields, but i don't want to see the same "contatto" repeated more times

#607416

OK, as your request, I forward it to our supporter Beda, he manages the feature request of Views plugin, but there isn't any ETA to implement this feature, you can subscribe to our blog to get the updated news:
https://toolset.com/blog/

#607761

Perfect, thanks Luo!

#607833

You are welcome