Skip Navigation

[Resolved] Adding dynamic gallery

This support ticket is created 6 years, 2 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 5 replies, has 2 voices.

Last updated by mouneebS-2 6 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1151204
Screen Shot 2018-11-22 at 2.34.22 PM copy.jpg

Hi nigel,

Please suggest me a way for adding gallery and then loading it in specific template.
For now I'm using ACF plugin to upload images to specific posts. And then adding gallery field by using toolset " Load non-Types custom fields". But this method is not useful for me as I want to make this section as attachment.

Thank you

#1151254

Nigel
Supporter

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

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

Sorry, I'm not quite sure what you need.

"I want to make this section as attachment", what do you mean by this?

Are you talking about using the built-in WordPress gallery shortcode?

Is that why you are using ACF image fields instead of Types image fields? (I'm not sure how ACF image fields are stored, but the gallery shortcode needs a list of image post IDs, maybe ACF stores them like that?)

#1152921

Hi Nigel,

I mean, I want to display images that are added by ACF gallery in custom posts.
Only the images related to specific post show.

But when I load the page it shows numbers like 948,952. I believe that are database id's for the images. Please provide a solution so I can display images.

Thank you

#1152926
Result.jpg
Image gallery specific to post.png
Calling ACF field through toolset.png
ACF gallery field.png

Please see images and read their names.

#1153049

Nigel
Supporter

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

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

Toolset itself doesn't have any way to output ACF Gallery fields as a gallery of images.

ACF itself doesn't have any way to output ACF Gallery fields as a gallery of images, without writing PHP.

The ACF documentation gives an example of using PHP to output the gallery of images: hidden link

You could modify that so that it worked with a shortcode, which would mean building the markup as a string to be returned by the shortcode, rather than echoing each part as in their example.

Then you could include the custom shortcode in the template you make with Toolset.

You can read about creating custom shortcodes here: https://developer.wordpress.org/plugins/shortcodes/

However, I tested simply using the built-in WordPress gallery shortcode, and using the wpv-post-field shortcode to provide the list of IDs (coming from the ACF Gallery field), and that seemed to work.

I can't say for sure that it will with Divi in the context you are using, but you could try replacing where you currently output the field value directly with

[gallery ids="[wpv-post-field name='gallery_custom']"]
#1153573

My issue is resolved now. Thank you!