Skip Navigation

[Resolved] Conditional if repeating field group has value

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

Problem: I would like to use a custom shortcode in a conditional statement, but it's not working.

Solution: Be sure to register the shortcode in Toolset > Settings > Front-end Content > Third party shortcode arguments.

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
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 2 replies, has 2 voices.

Last updated by Ian 5 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1239931

Ian

I have added the shortcode provided in this article https://toolset.com/forums/topic/count-entries-in-repeatable-group/ and it works fine.

I am trying to use the value as part of a conditional statement in order to show the correct wording

[wpv-conditional if="( '[show_rfg_count type="bylaw-amendments"]' eq '1' )"]<span class="category">, [show_rfg_count type="bylaw-amendments"] Amendment</span>[/wpv-conditional]

[wpv-conditional if="( '[show_rfg_count type="bylaw-amendments"]' gt '1' )"]<span class="category">, [show_rfg_count type="bylaw-amendments"] Amendments</span>[/wpv-conditional]

I am not getting any results

#1239933

Hi, have you added this shortcode in Toolset > Settings > Third-party shortcode arguments? If not, please add it and test again. If it's still not working as expected, add the debug attribute to each shortcode to see some more information about what's going on:

[wpv-conditional if="( '[show_rfg_count type="bylaw-amendments"]' eq '1' )" debug="true"]<span class="category">, [show_rfg_count type="bylaw-amendments"] Amendment</span>[/wpv-conditional]

[wpv-conditional if="( '[show_rfg_count type="bylaw-amendments"]' gt '1' )" debug="true"]<span class="category">, [show_rfg_count type="bylaw-amendments"] Amendments</span>[/wpv-conditional]
#1239992

Ian

That was it, thanks