Skip Navigation

[Resolved] Using a single field multiple times in a wpv-for-each loop?

This support ticket is created 3 years, 11 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Shane 3 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#2298611
wpv.jpg

I'm trying to create a phone link from phone numbers stored as numbers in a repeatable field.

I'm using the "custom" option in the Display Settings (in the Gutenberg editor, WP v5.9), using the following code:

<div>
[wpv-for-each field="##FIELD_SLUG##"]
##FIELD##
[/wpv-for-each]
</div>

What I'd expect is: 12345

What I get instead is: ##FIELD##

Here's a screenshot, with the code edited for visibility:

#2298939

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Filip,

Thank you for getting in touch.

Based on what I see in your code below. You are adding the shortcode exactly like below which is incorrect. I see that you still have "##FIELD_SLUG##" which needs to be replaced with the actual slug of your custom field as ##FIELD_SLUG## is just a placeholder.

[/php]
<div>
[wpv-for-each field="##FIELD_SLUG##"]
##FIELD##
[/wpv-for-each]
[/php]

So what you should have should be similar to below.

[wpv-for-each field="wpcf-my_slug"]
<a href="tel:[types field='my_slug' output='raw'][/types]"> [types field='my_slug' output='raw'][/types]</a>
[/wpv-for-each]

Where you will replace my_slug with the slug of your repeatable field.

Thanks,
Shane