Skip Navigation

[Resolved] Filtering view output by date range and relationship count

This support ticket is created 3 years, 4 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
- 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)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 3 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#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

Languages: English (English )

Timezone: 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.

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