Skip Navigation

[Resolved] Creating a view of CPT with two one-to-many relationships

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

Our next available supporter will start replying to tickets in about 1.26 hours from now. Thank you for your understanding.

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 4 replies, has 2 voices.

Last updated by Lee 5 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1315125

Lee

Please refer to my previous ticket, #1314147.

I have the three CPT's as noted in; Location, Performers and Performance (the CPT that connects the two CPTs with the fields Start Time and End Time).
I want to create a (table) view to display all scheduled performances. With column headings; Location, Start Time, Performer and Performer Excerpt.
When I attempt to create the view from the Dashboard. Select all three CPT in Content Selection. But none of the fields from the Location or Performers are available to add to view.

#1315177

Hello,

I suggest you try these:
Create a post view:
- Query "Performance" posts (only one post type)
- In view's loop, display it's parent "Location" and "Performers" information, see our document:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-one-related-item-parent
section "Displaying one related item (parent)"

#1316813

Lee

I've gotten basic views I needed to display. But in my "Performers" CPT, I have the "Active" checkbox field. Its configured as default to save with value "1" with checked.

Now in my view I've created without any filters it displays and formats the CPT data properly. But I would like it to only display the CPT records that are "Active". I create a Query Filter with Custom Field Filter, "Select items with field: Active Performer is a number equal to 1".

But no results are returned. Suggestions?

Second question. What is better practice? I have two similar fields for Performers CPT, "Active" and "Featured". Which is better? Create as a custom field in the CPT or CPT Taxonomies?

Thanks,

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/forums/topic/two-more-questions-filter-with-checkbox-field-and-what-is-better-practice/

#1316825

I assume the original question of this thread is resolved, for the other new questions, please check the new thread here:
https://toolset.com/forums/topic/two-more-questions-filter-with-checkbox-field-and-what-is-better-practice/

#1322235

Lee

I've decided to adjust my CPT fields slightly. I added a 'featured" checkbox field to the Performances CPT. As well as the "featured" checkbox that was already in the "Performers" CPT.

In the end I determined there were both Featured Performers and Featured Performances.

I've created two views, one to display featured performances and a second to display featured performers.

Thanks for your assistance. Consider this issue closed.