Skip Navigation

[Resolved] conditional display from the value of a field inside a RGFs.

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

Problem:

I'm building a real estate website.
A Property is a kind of domain with a list of available items (I called them "Lots" : houses, apartments, chalet, etc...) and has multiple custom fields.

One is what the property contains: type of "Lots" and quantities (fields from a repeatable group of fields).
How much apartments, how much houses, etc

With a View I can display which item and how many pieces there are.

BUT I'd like to set a conditional display based on the quantities. Add a "s" if there is more than 1 item and display a svg related to the item. The pictograms will be different if it's an apartment or a house. In order to achieve the kind of result in the attached picture.

Solution:

You need to setup a child post view:

https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items

In the section "Loop Editor" of above child post view, you can get the found post count with shortcode [wpv-found-count]:

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-found-count

Use it as condition of shortcode [wpv-conditional], and display different result:

https://toolset.com/documentation/legacy-features/views-plugin/using-shortcodes-in-conditions/

Relevant Documentation:

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.

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: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by fabriceS 4 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1834421
Screen Shot 2020-11-04 at 14.00.59.png

Hi

I'm building a real estate website.
A Property is a kind of domain with a list of available items (I called them "Lots" : houses, apartments, chalet, etc...) and has multiple custom fields.

One is what the property contains: type of "Lots" and quantities (fields from a repeatable group of fields).
How much apartments, how much houses, etc

With a View I can display which item and how many pieces there are.

BUT I'd like to set a conditional display based on the quantities. Add a "s" if there is more than 1 item and display a svg related to the item. The pictograms will be different if it's an apartment or a house. In order to achieve the kind of result in the attached picture.

However, it's impossible to test the value of the retrieved repeatable field.

How can I do that ?

#1834431

Maybe it's easier to give you access to the admin...

#1835227

Hello,

You need to setup a child post view:
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items

In the section "Loop Editor" of above child post view, you can get the found post count with shortcode [wpv-found-count]:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-found-count

Use it as condition of shortcode [wpv-conditional], and display different result:
https://toolset.com/documentation/legacy-features/views-plugin/using-shortcodes-in-conditions/

#1841681

My issue is resolved now. Thank you!