Skip Navigation

[Resolved] Return # of images rather than posts (repeatable)

This support ticket is created 4 years, 1 month 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by jasonw-2 4 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1792281

Hi there!!!

I have a CPT where my client can upload images to show in a gallery. I have a repeating image field and a post form for them to upload said images. I am trying to limit the number of images shown in the gallery to 18 but I'm pretty sure I just realized that my view setting of "Display 18" is displaying 18 posts worth of images. So if there are more than 1 image (using the repeating field) per post then it's showing the 18 actual posts (worth of images) instead of 18 images in whole.

I'm using this for the loop:
[wpv-for-each field='wpcf-inmanimages']
[types field='inmanimages' width='150' height='150' align='none' resize='crop'][/types]
[/wpv-for-each]

and a blocks content template attached to the view being output into an Elementor page. Seems to work fine with the exception stated above.

I've spent a couple hours in here trying to find a solution.

Also: I am going to want to display all with pagination on a different gallery page, so please let me know if I need to keep that in mind with whatever solution we end up with.

As always, thanks so much!!!

Jason

#1792741

Hello,

I assume we are talking about a post view:
- Query your custom posts
- In view's loop, you are displaying the repeating image field with the codes you mentioned above.

If it is, then it is expected result:
So if there are more than 1 image (using the repeating field) per post then it's showing the 18 actual posts (worth of images) instead of 18 images in whole.

The post view can only setup limitation on posts, it can not setup limitation on repeating image field.

You might consider other workaround, for example:
Display only one image for each post, replace the codes you mentioned above as below:

[wpv-for-each field='wpcf-inmanimages' start="1" end="1"]
<a href="[types field='inmanimages' size='full' url='true'][/types]">[types field='inmanimages' width='150' height='150' align='none' resize='crop'][/types]</a>
[/wpv-for-each]

More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153482

#1793567

Thanks, Luo.

I think it would be easier to just change the repeating field to a single image. *Far less confusing for the client.

Thank you for trying to help!!

#1793569

My issue is resolved now. Thank you!