Skip Navigation

[Resolved] Unable to show repeating custom field images in a loop

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

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by katrina 4 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#1428625

I am trying to: Display a thumbpeg gallery of all the images on a post type that are of a particuar repeating custom field image

Link to a page where the issue can be seen: I can provide in a private message

I expected to see: Gallery of thumbpegs

Instead, I got: No images showing

I have a custom field that is a repeating image called "featured-image-for-slider".

I have a view called "My Slidey" which selects "posts" to display, and has the following code in my loop:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop>
      <div id="bingo">
		[wpv-for-each field="wpcf-featured-image-for-slider"] 
         [types field='featured-image-for-slider' title='%%TITLE%%' alt='%%ALT%%' size='thumbnail' resize='proportional' separator=', '][/types]
	    [/wpv-for-each] 
      </div> 
</wpv-loop>
		<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

with the following CSS:

#bingo {
  background-color:#27d8af;
  min-height:500px;
}

When i embed by View inside my Content Template for those post types—using the new Toolset Blocks editor—nothing shows on the front end except for my Bingo container in turquoise. None of the repeating custom field images display at all. So, the View displays, but not the repeating images as thumbnails.

What am i obviously doing wrong? I'm sure i've done this before, but perhaps my brain isn't awake any longer.

#1431243

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

With the code you shared I see that the [types] shortcode that displays the image is having the separator=', ' attribute.

<wpv-loop>
      <div id="bingo">
        [wpv-for-each field="wpcf-featured-image-for-slider"] 
         [types field='featured-image-for-slider' title='%%TITLE%%' alt='%%ALT%%' size='thumbnail' resize='proportional' separator=', '][/types]
        [/wpv-for-each] 
      </div> 
</wpv-loop>

When you display the repeating field using [wpv-for-each] shortcode, you should add the [types] shortcode without the separator attribute to display the single instance within the [wpv-for-each] loop.

Can you please try to use the following code and check if that helps you to resolve your issue where I just removed the separator attribute added to types shortcode.

<wpv-loop>
      <div id="bingo">
        [wpv-for-each field="wpcf-featured-image-for-slider"] 
         [types field='featured-image-for-slider' title='%%TITLE%%' alt='%%ALT%%' size='thumbnail' resize='proportional'][/types]
        [/wpv-for-each] 
      </div> 
</wpv-loop>
#1431689

Thanks so much Minesh - your solution worked!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.