Skip Navigation

[Resolved] Display RFG (Repeatable Field Groups) of several Posts

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

Problem:
How can we create a list of RFG (Repeatable Field Groups) of several posts?

Solution:
Create a View that lists the posts you want it's RFG to display.
Then, create another view that displays the RFG post Type with a Query Filter "Select posts in relation to the current post in the loop"
Now insert this View to the first created View's loop.
That View instead insert it to any page.

You will now see a list of posts with their RFG below it (each post)

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

This support ticket is created 5 years, 9 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by aldoR 5 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#1190947

I created this website for a client, my requirement is to create a page where a different menu is shown every day.

I created a post type menu with various fields and a date field, this is the actual output layout hidden link

Now how can I create the view for a page with the automatic filter that changes menu every day?

Thanks in advance
Aldo

#1190975

Everyday changing is not possible to set in a View, but you can set random order, for example, this would change the order of a certain amount of posts everytime the view is loaded, and if the view is limited to less than the available posts, even everytime new posts can appear.

You mention in the title that you want to show the content based on a date field.
Do you plan to define ahead at which date, which menu will be displayed, and you do that in a custom date field?

Then, it's easier.

You can create a view as you have it already, and order it by let's say post date, and set a query filter that filters out only the posts where the current day matches the day set in the custom field.
Note, this will be a finite date, not a repeating day in the week or month or year, but a finite timestamp, unique, never to be displayed again and only once: The day it matches in the field.

You could then of course change manually the field value to make the menu appear again at a different day.

If this solution would work, follow the below steps:

1. Create a View where you list the Posts part of the Menu and complete the View's Loop as per your requirements
2. Make sure your posts feature a Toolset Date Custom Field and have values in it for several posts, representing several days
3. Create a query filter in the View where you Select items with field: your_date_field is a number equal to TODAY().
4. Insert the View where your menu shall show, it should now display only items where the custom field is within TODAY().
(Hence, tomorrow another set of items is displayed)

#1191088

Ok good!!

I confirm that each menu has a date field with a definited date (es. menu 1 is today, menù 2 is 25/02/2019, menu 3 is 26/01/2019...)

So I create a view with my layout template and in the query filter I put this filter "Data menu is a number equal to TODAY()"
but if i see the page with this view I don't see anything

now this is the menu with the right template hidden link
and the page with the view query by date is empty hidden link

Can you help me to complete this part?
thanks again
Aldo

#1191395

That seems a WPOD; this means, a White Page of Death, or https://codex.wordpress.org/Common_WordPress_Errors.

It usually happens when a PHP fatal error stops the page from rendering.
That should not be related to the View, I am not aware of any fatal errors on it.

I'd suggest enabling WP Debug and see what the error is - then resolve it, so we can proceed with the View.
https://codex.wordpress.org/WP_DEBUG

The error might point to a plugin file, even to Toolset's Plugins. Disable that plugin to resolve the error (for now)
Please let me know the exact wordings (copy, paste) of the error if it is related to Toolset Plugins or you think it is.

I also activated private login details for you to submit me access to either the live or staging site.
Please specify precisely what you provide me access to and what I can do.
I would then - if required - create a small example view for you to use as a start.

Also, if you cannot succeed with above Error handling, I might be able to help
Please consider that a site should always be backed up before you grant anyone access to (even us Toolset Support) and please specify what can be done/what not.

#1191425

Got it, thanks.

The Content Template is empty which you attached to the View hidden link
In "Loop item in view menu del giorno", nothing is inserted.
I now inserted "This" as an example string.

The Output editor of the View as well is empty, which is not alike by default when you create a View.
The Output editor must include at least [wpv-filter-meta-html] and [wpv-layout-meta-html] (or one of both depending on the need).

Now the View says "no items found", on the sample page, this is because your filter applied to the View queries and filters all pages that are not of TODAY (set in that Custom Date Fields) and removes them from the results as expected.
You only have 3 pages and of those 3 none has a date set of today for the field.

I believe this is not set properly in the View you use on the page, as there you query "Page" post type but I think in fact you want to query "Menu" post type.

Please adjust your View (I would start from a fresh one to avoid missing parts) and query Menu.
Then, in the query filter, you can add the filter by that Field as instructed previously, so after completing the Loop of that View with the contents you want to output, you insert the View to a page (or location where you want the View to appear)

I have made an example here:
hidden link
hidden link

This should help to solve the issues, as you can immediately build on top of that view.

#1191586

Ok thanks Beda for your help...

I saw your examples and start to understand the logic but I still can not insert the fields to show in the output.

if you see the menu page with the template I created es. hidden link

this is the backend of the menu, where there are several fields grouped with their view hidden link

this is the template I made hidden link

Now this setup works perfectly to display the menus individually, but I can not understand and how to create a page with the view (eg remove-me) that displays the menu template as the single template used for the menus

If I try to add a repeatable field of a menu in the view remove-me in the output I exit "no item found" see hidden link

this is what I put in the view remove-me for testing

--- I am a mneu of today [wpv-post-title] [types field = 'data-menu' style = 'text' format = 'F j, Y'] [/ types]
[wpv-view name = "first-auto-dishes"] ---

on the page the date appears correctly but no item connected to the repeatable field "primi-piatti-auto"
hidden link

I hope I have explained better to you my needs
Thanks again
Aldo

#1192382

It seems you want to display the RFG fields (Repeatable Field Groups fields) in the View's output.
So, you have the Post Type Menu and several posts in it, but you want to display each of those Menu posts RFG's, according to what date the menu has saved (so, only RFG of Menu of Today).

If that is correct, you need a second instance of the View.
One view will show the Menu posts of Today as we discussed already.
In that View's loop, instead of any content of the Menu Post (well, maybe it's the date), you insert another View.
That View, in turn, queries the RFG (Repeatable Field Group) and has a Query filter to return only RFG that belong to the post as set in the parent View's Loop.

Later, this View is completed with the output as in Fields of the RFG you want to display

I have created a view "RFG-remove-me" and made the edits as above explained.
Then I used this page to show the results:
hidden link

If you would want to display related posts instead it would be the same, you just would need to adjust what the view (RFG-remove-me) queries and adjust it's Query Filter as well.

#1193394

My issue is resolved now. Thank you!