Skip Navigation

[Resolved] Display Conditional Content based on Repeatable Field Group Having Value

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

This topic contains 1 reply, has 2 voices.

Last updated by Beda 6 years, 6 months ago.

Author
Posts
#1079761
Screen Shot 2018-08-10 at 12.08.49 PM.png
Screen Shot 2018-08-10 at 12.06.58 PM.png
Screen Shot 2018-08-10 at 12.07.18 PM.png
Screen Shot 2018-08-10 at 12.07.39 PM.png

Currently, I am trying to display a custom product page and have certain fields/content conditionally displayed using Toolset Views. Within this view I wanted to use a conditional format of a repeating field.

If a certain repeating field has any value other than blank/empty I wanted a certain section of code to display. If that field didn't have any values I didn't want to display the section.

Currently I was trying to use this resource to setup my custom function and am not getting anywhere. Please let me know where I might be going wrong.

Following the - Check If A Types Repeating Field Has A N-th Item-
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-custom-functions-in-conditions/

My current setup is attached as screenshots.

#1080204

That documentation is for repeating fields, not repeatable field groups.

Repeatable Field Groups as you seem to use them are Posts, in fact, nom fields, so it will work much differently.
You can for instance not call those in a Post View but need to create a specific (Post) View for these RFG Fields.

Checking if a Field of them is empty would then work similarly as "normal" HTML conditional where you simply checkup the current posts (RFG) field in a View.

Let me explain:

1. Cerate a RFG with several Fields
2. Populate them in a post
3. Create a View and choose to display that RFG
4. In the View loop use HTML conditional to check upon single fields in that/those RFG items

The new RFG's store their order sequence in toolset-post-sortorder Custom field against each RFG Repeating item.
So for example, if you display RFG's in a View, you can checkup that field value to address single items of a RFG