Skip Navigation

[Resolved] Repeating fields – How to add the current image in the ‘separartor’

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

Problem:
The essence of this ticket is that the user wanted assistance with displaying their repeatable fields individually.

Solution:
The repeatable fields can be displayed using the shortcode below.
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-for-each

This support ticket is created 3 years, 6 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 sandraB-2 3 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#2113125

I am trying to output a repeating image field in a Content template. The output is used for a carrousel. Ans when you click on an image in the carousel a lightbox is opened with a slideshow of the images.

The code that has to be repeated must look like this:

<li>
     <a class="uk-inline" href="<em><u>hidden link</u></em>" data-caption="Caption 1">
         <img src="<em><u>hidden link</u></em>" alt="">
       </a>
</li>

The URLs in the code above must be replaced by the urls of the repeated images field entries.

In an earlier version (without the lightbox) I used this code:

<li>
    [types field='foto-s' title='%%TITLE%%' alt='%%ALT%%' size='full' class='uk-cover' separator='</li><li class="">'][/types]
</li>

What I want is add 'the current image' in the shortcode in someway. My quess is something like this but then instead of the hardcoded url I want the url to the current image:

<li>
    <a class="[types field='foto-s' title='%%TITLE%%' alt='%%ALT%%' size='full' class='uk-cover' separator='" data-caption="Caption 1"><img src="<em><u>hidden link</u></em>" alt=""></a></li><li class=""><a class="'][/types]
</li>

(something weard happens with de html code. Hij keeps making listitems of them. I hoop you kan see the text as I have typed it 🙂
My question is what do I use to replace the URL in the seperator="" area?
Can you help me with this?

Kind regards,
Sandra

#2113647

Shane
Supporter

Languages: English (English )

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

Hi Sandra,

Given that this is the case wouldn't it be better if you listed out each of the images individually in the correct format that the lightbox requires?

Have a look at the shortcode below.
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-for-each

Using the wpv-for-each shortcode you are able to list out each of the individual images which would allow you to correctly add your list tag separators.

Please let me know if this helps.
Thanks,
Shane

#2114299

My issue is resolved now. Thank you!