Skip Navigation

[Resolved] Output Repeating Field and wrap each in href

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

Problem:

In this ticket the user wanted to wrap each of his repeating fields in a url.

Solution:

What you can do is to use the [wpv-for-each ]
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153482

This way you can loop through each of the fields and add the link to it .

Like this.

<ol>[wpv-for-each field="wpcf-my-field"]<li><a href="[types field='my-field' output='raw'][/types]>[types field='myField'][/types]</a></li>[/wpv-for-each]</ol>

This support ticket is created 6 years, 4 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 2 replies, has 2 voices.

Last updated by colinC 6 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1106758

In my Custom Field Group I have a Single Line Field which is a Repeating Field- Admins can add multiple instances of the field in the backend.

I can easily output the repeating field values in my View by using:
[types field='myField'][/types]

This outputs the contents simple as- item1, item2, item 3 etc

What I'd like to output using the View Template is something along the lines of:
item1
item2
item3

Any help please?
Thanks

#1106791

Shane
Supporter

Languages: English (English )

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

Hi Colin,

Thank you for contacting our support forum.

What you can do is to use the [wpv-for-each ]
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153482

This way you can loop through each of the fields and add the link to it .

Like this.

<ol>[wpv-for-each field="wpcf-my-field"]<li><a href="[types field='my-field' output='raw'][/types]>[types field='myField'][/types]</a></li>[/wpv-for-each]</ol>

Please let me know if this helps.
Thanks,
Shane

#1106901

That's great Shane - thankyou very much. Exactly what I needed.