Skip Navigation

[Resolved] Need to display repeatable fields from a related post type

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

Problem: I would like to display a list of a repeatable field group (RFG) in a post template. The RFG belongs to a related post of the post being displayed in the post template.

Solution:
- Create a View of the RFG, filtered by post relationship, where the parent Race Result PDF is set by the current post in the loop. In the loop of this View, output your custom field information.
- Create a View to display Race Result PDFs only. It should have a Post Relationship Query Filter, where the parent Race Event is the post where this View is displayed.
- Place the View of Race Result PDFs in the template for Race Events. This is the only View that should be placed in the Race Results section.
- In the Loop of the View of Race Result PDFs, place your View of the RFG. You can also output the title of the Race Result PDF if necessary, or any other information from the Race Result PDF that will help you break up the display of your data.

Relevant Documentation:
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/

This support ticket is created 5 years, 7 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by codyK 5 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#1267061
Screen Shot 2019-06-12 at 10.08.47 AM.png

I am trying to: Display repeatable fields from a related post on a single post page. I have 2 CPT (Race Events and Race Result PDFs). They have a 1 (Race Event) - Many (Race Result PDFs) relationship. The repeatable fields belong to the Race Result PDFs CPT. I have 3 different repeatable fields (Overall Results, Results by Class, and Penalties). I created a View to loop through each of the repeatable fields and display all the data. I followed the instructions on this page(https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/) for how to set it up. These 3 views are called (Repeatable Group Display - Overall Results, Repeatable Group Display - Results By Class, and Repeatable Group Display - Penalties). I then placed that View shortcodes in a Content Template for the CPT Race Events. My goal is to have it show the repeatable fields from the related Race Result PDFs CPT on the Content Template for Race Events.

Link to a page where the issue can be seen: hidden link

I expected to see: 3 dropdown boxes showing under the RACE RESULTS Section. I attached a screenshot of the section where they should be showing.

Instead, I got: nothing is being displayed. I believe the issue lies in the setup of my Views and making sure they pick up the repeatable field AND the relationship.

#1267103

You only need two Views here, one nested inside another. Here's how I would set this up:
- Create a View of the RFG, filtered by post relationship, where the parent Race Result PDF is set by the current post in the loop. In the loop of this View, output your custom field information.
- Create a View to display Race Result PDFs only. It should have a Post Relationship Query Filter, where the parent Race Event is the post where this View is displayed.
- Place the View of Race Result PDFs in the template for Race Events. This is the only View that should be placed in the Race Results section.
- In the Loop of the View of Race Result PDFs, place your View of the RFG. You can also output the title of the Race Result PDF if necessary, or any other information from the Race Result PDF that will help you break up the display of your data.

#1267147
Screen Shot 2019-06-12 at 12.02.51 PM.png
bitd.rhinohubdev.com_wp-admin_admin.php_page=ct-editor&ct_id=4997.png
bitd.rhinohubdev.com_wp-admin_admin.php_page=views-editor&view_id=5181.png
bitd.rhinohubdev.com_wp-admin_admin.php_page=views-editor&view_id=5180.png

Hey Christian,

Thanks so much for the quick response! I am still having some issues, but I am not sure if I have set it up exactly how you are suggesting. I have included screenshots of the 2 Views, the 1 Content Template, and what I am seeing on the front end. I am guessing the issue is with one of my Views and the Query filter I have set up. Can you check on them and let me know if there is anything that looks like it is incorrectly set up?

#1267181
Screen Shot 2019-06-12 at 3.11.31 PM.png
Screen Shot 2019-06-12 at 3.16.06 PM.png

Okay I added some text in the first View, so you can understand what is happening. The "No items found" message is from the inner View. I made some screenshots here so you can see how to fix the inner View.

#1267251

That worked for me! I replicated it to the other RFGs and it is displaying properly now. I appreciate the help and direction!