Skip Navigation

[Resolved] shortcode field gallery

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

Problem:
The user would like to create some links from a repeatable image field.

Solution:
Use the wpv-for-each shortcode as follow:

[wpv-for-each field="wpcf-image-41269c36" ]
<a href="[types field='image-41269c36' size='full' url='true' separator=' '][/types]" data-lbwps-gid="ba-[wpv-post-id]" ></a>
[/wpv-for-each]

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153482

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

Last updated by federicoA 1 year, 6 months ago.

Assigned support staff: Jamal.

Author
Posts
#1678015

Hi,
I need help to print the code of a field gallery.
I used this code but I only print the first element of the gallery in a loop.
<a href="[types field='image-41269c36' size='full' url='true' separator=''][/types]" data-lbwps-gid="ba-1" ></a>
what am I doing wrong?
thanks
federico

#1678137

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello federico and thank you for contacting the Toolset support.

I assume that your field "image-41269c36" is a repeatable field, right? In that case you may want to use the wpv-for-each shortcode and generate the link inside of it. More about the shortcode here https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153482

If it is not the case, please allow me temporary access to your site and let me check the view/content template closely. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#1679065

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello frederico,

Can you double-check the username and password? They are not working for me. Your next reply will be private to let you share new credentials safely.

I would also like to ask, what do your mean by I used this code but I only print the first element of the gallery in a loop.? Do you mean an image field or a gallery with multiple images?

#1686933

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Thank you for your feedback. I can see the issue. I also tried to fix it, but I think that this has something to do with one of the latest WordPress core updates that act on images. In fact, we have released Toolset Types 3.3.12 just to fix that issue on 3.3.11 after WordPress has introduced a new way of handling images.

Please update all Toolset plugins and test again, if the issue persists, allow me to take a Duplicator copy for further debugging locally, and eventually for escalation if I am unable to fix it.

#1688217

I have updated the plugins. sorry I do not understand: is the shortcode in the image field is with multiple instances correct?

#1688795

My issue is resolved now. Thank you!

[wpv-for-each field="wpcf-image-41269c36" ]
<a href="[types field='image-41269c36' size='full' url='true' separator=' '][/types]" data-lbwps-gid="ba-[wpv-post-id]" ></a>
[/wpv-for-each]