Skip Navigation

[Résolu] Filtering view output by date range and relationship count

This support ticket is created Il y a 3 années et 11 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Marqué : ,

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Minesh Il y a 3 années et 11 mois.

Assisté par: Minesh.

Auteur
Publications
#1870521

I want to create a view that shows how many "Setlists" a "Chart" is used in over a period of time.

"Setlists" and "Charts" are both CPTs. They are in a relationship through an intermediary post type "Charts Setlists." The Setlist CPT uses a required custom date field—this is what I want to use for the date range filtering.

The very basic idea is to display each result in a row where the Chart name is on the left and the quantity (#) of Setlists that Chart has been connected to is on the right. Example:

Song Name One 3 (number of Setlists this Chart is attached)
Song Name Two 7
Song Name Three 4

I've been able to find ways to display this info using one view for Setlists with [wpv-items-count] inserted into another view for Songs, but then the date filter doesn't work because the date filter is connected to Setlists.

Anyway, I hope I've explained this well, and am hoping there is a solution. If you need more from me please let me know.

#1871501

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

The thing is that, you can filter the view using custom fields that is associated with post type you set to query your view. Having said that, if you set your view to query post type Songs, you can add frontend filters/custom search filters for the custom fields that should belongs to post type Songs.

There is no way to filter the view using custom field that is part of another post type as it will give you unexpected results and its not recomonded.

The workaround would be to copy the date field to your song post type by adding a new date custom field to your song post type and then add the date filter.