Skip Navigation

[Resolved] Setting up an image gallery for a custom post type

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

Problem:
How to create a slider from images stored as custom fields on a post?

Solution:
Since Types 3 it is possible to achieve this using Views' built-in slider functionality (which is intended to rotate between slides from different posts, not the same post).

- set up a repeating field group and include an image field (and any other fields you may need such as caption)
- add images and captions to your posts
- create a View which in the Content Selection will query the repeating field group
- add a Query Filter to specify that the repeating field group belongs to the post where this View is being displayed
- design your Loop Output according to the documentation for creating sliders
- insert this View into the template where you display your posts.

Relevant Documentation:
https://toolset.com/documentation/user-guides/creating-sliders-with-types-and-views/

This support ticket is created 6 years, 7 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 3 replies, has 3 voices.

Last updated by Easyweb Consulting 6 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#912705
Screen Shot 2018-06-12 at 19.36.13.png

Tell us what you are trying to do? I'm trying to create an image gallery on a custom post. My approach is to create a custom field for the custom post, but there is no field type for an image gallery as far as I can tell. (Is there another, or better, way?)

Is there any documentation that you are following? No, but I read the following two forum posts before writing this message:
https://toolset.com/forums/topic/photothumbnails-slider-gallery-for-my-custom-post-type/
https://toolset.com/forums/topic/how-to-display-repeating-image-fields-into-a-slider/

Is there a similar example that we can see?

What is the link to your site? I am uploading a link to a screenshot of the design. The slideshow is toward the top of the page, beneath the page title.

#912817

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

Before Types 3.0 this required you to manually integrate a slider library such as flexslider, which I describe in detailed steps here: https://toolset.com/forums/topic/how-to-display-the-pics-i-uploaded-as-a-slider/#post-518295

You use a repetitive image field on your posts (so that you can add multiple image fields to the same post), and then in your template loop over these fields using the wpv-for-each shortcode to output them in the markup format required by your chosen slider library (flexslider in the example).

Views already included slider functionality (https://toolset.com/documentation/user-guides/creating-sliders-with-types-and-views/), but this was to make a slider that transitioned between posts, not different fields from an individual post.

Types 3.0 introduced repeating field groups, so that you could have both an image and a caption field grouped together and then add as many of these as you need to an individual post. Under the hood this works by creating a new post for each repetition that acts as a container for the group of fields.

This is exactly what you need to use the existing Views slider functionality as outlined in the above document, where your slider will transition between the posts that act as containers for the image and caption fields.

So

- set up a repeating field group and include an image field (and any other fields you may need such as caption)
- add images and captions to your posts
- create a View which in the Content Selection will query the repeating field group
- add a Query Filter to specify that the repeating field group belongs to the post where this View is being displayed
- design your Loop Output according to the documentation for creating sliders
- insert this View into the template where you display your posts.

Let me know if you get stuck.

#913612

This did the trick. Thanks!

#1288013

Hello.
I followed the step as you wrote but something goes wrong.
I have post type named charter
I have a lot of custom field divided in groups that I use in content template for single charter.
I designed content template with beaver builder
I created a new custom field only for charter image with repeaiting field.
I created a view as you wrote but depending from query filter or are showing all the image in my site or nothing are showing.
I can't understand where is the problem