Skip Navigation

[Resolved] Reference field on a repeater

This support ticket is created 4 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 Louis-Philippe 4 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1447011
repeater-reference.jpg

Tell us what you are trying to do?
HI I have a site yoga center site where I want to create a weekly calendar for activities on each days and the teacher that are offering.
I created a custom post field CALENDAR where i have a repeater for each days of the week.
Under this repeater, i will have start and end time in a single line field,
as for activities and teacher, I would love to see a list of both cpt items created under activities and teachers already in the site. I though i could une the reference field easely, but can't do.

I would love any ideas as a workeround to achieve a similar tool please.
I mean a selector / reference field from a CPT as a part of it knowing that I have a 7 days week with many classes and teachers repeating on different time.

Thank you 😉

#1447599

Hi, it looks like Activity and Teacher are both custom post types. If that is correct, there isn't a very simple way to achieve this in a Repeatable Field Group (RFG). You could include a numeric field that holds the Teacher ID, and another numeric field that holds the Activity ID. That would allow you to connect with those other posts, but then the problem is it is not easy to remember numeric IDs for each Teacher and each Activity. Managing the RFGs becomes much more difficult, and if you plan to use front-end search filters to filter by Teacher or by Activity, then this solution is not practical. If you try to create a custom search filter by Teacher ID or Activity ID in this case, your site visitors will find those filters unintelligible because the filters only show numeric IDs, not Teacher names or Activity names. So if you want to use front-end search, this solution is not very practical.

Another solution is to not use RFG at all. Instead, use one custom post type for Weeks and another custom post type for Days.
Then create a one-to-many relationship between Weeks and Days. You will create a new Day post for each day in the Week. In the Days post type, you can use a post reference field to link to a Teacher or to an Activity. In this solution, you do not need to remember post IDs and custom search filters are easy to understand.

Let me know if you have questions about either approach.

#1449135

Hi Christian, thank you for your replies.
Both solutions can't work for ease of use for the clients.
I will still try to figure out the second one because in each day there will be Many Activities (already connected to the Teachers) that would each have a specific time. So i can't get how to do it without the RFG.

Maybe if i reverse the problem and add the Days and time in the ACTIVITIES CPT that will work, but my wish was to avoid it for ease of use.

Anyhow, your answer already helps.

Also less relevant I know that ACF have a field objet (same as post reference in toolset) that can be add to a repeater, even in a repeater within a repeater so can I suggest the team to add the support in future development?
thank you

#1449195

Okay so it sounds like you could create an Activity post type that contains information about the time and has a many-to-many relationship with Teacher posts. Then you could create a Day post type that has a many-to-many relationship with Activities. Then you could create a Week post type that has a many-to-many relationship with Days.

If you'd like to see repeating post reference fields, I encourage you to submit your request here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
This form will put your request in front of our management team, so they know it is important.

#1449521

Thank you, i will work a little more for this but your help was precious!

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