Skip Navigation

[Resolved] Repeatable Field Group or not?

This support ticket is created 4 years, 1 month 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 0.20 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: Africa/Casablanca (GMT+01:00)

This topic contains 3 replies, has 2 voices.

Last updated by Jamal 4 years, 1 month ago.

Assisted by: Jamal.

Author
Posts
#1814647

I'm working on a restaurant site.
Each week the daily menu for the next week will be published.
I will create a CPT "Weekly Menus" for this but I was wondering if I should use a RFG for the days of the week or just have regular fields for each day (like Monday_starter / Monday_Maindish / Monday_dessert / Tuesday_starter / Tuesday_Maindish / ...)

The menu of the current week must be published on a page with a fixed url and I can't figure out how to do this when using RFG.
Using regular fields I think I can just include a view which select only the fields from the most recent published CPT.
It would also be nice to be able to show for instance the menu of the current and next date on the homepage.

Also, I'm using Elementor and this works well for all fields except for RFG it seems 🙁
(I cannot just use a regular page which is updated daily as on publication a mail must automatically send to a mailing list)

Thanks for your advice!

#1814747

Hello and thank you for contacting the Toolset support.

I would suggest creating a "Daily Menus" custom post type instead of a "Weekly Menus" custom post type. Or you may create both and link them with a One-to-many relationship(to be able to create Daily Menus from the Weekly Menus post, on the backend).

You can then add a custom field day, to specify which day of the week. Or add a date field for the exact date of the day of the menu. You can then add your custom fields (starter, main dish, dessert).
I believe the date field will give you more flexibility for your views(homepage, or elsewhere), you can filter using the TODAY() function. Check this article https://toolset.com/documentation/user-guides/views/date-filters/

I am aware, that this will require you to publish 7 posts each week, but it will give more power on how to manipulate and display them.
And If you built a relationship between "Daily Menus" and "Weekly Menus", you will be able to create the new "Weekly Menus" post and its children "Daily Menus" posts, all from the same screen on the backend.

I hope this helps. Let me know your feedback or if you have more questions.

#1816317

Hi,
As you suggested I had a look at using relationships instead.
So I created a CPT " Daily Menu", which has fields for the 3 dished (starter, main, desert) a date-field and a price field.
Then I created another CPT "Weekly Menu" and a 1-to-many relation between these 2. A weekly menu can have max 7 dailies a child)
I created a content template for the single weekmenu with a view that shows fields from the child, so that's working fine.

Question now is how can I get an RSS-feed of the Weekly Menu, showing also content of the related daily menus?
weekmenu/feed/ only shows the title of the weekly menu

#1816505

Extending RSS-feed will require custom code, which is out of the scope of the support. Check our support policy https://toolset.com/toolset-support-policy/
You may want to hire one of our partners https://toolset.com/contractors/

But, if you want to build it yourself, check this article about extending WordPress RSS feeds https://code.tutsplus.com/tutorials/extending-the-default-wordpress-rss-feed--wp-27935

And check our relationship API, especially, the toolset_get_related_posts function https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts

You may also need to check our Types API, especially, the types_render_field function.
https://toolset.com/documentation/customizing-sites-using-php/functions/

I hope this helps. Let me know if you have any questions.