Tagged: Avia Gallery, CPT, custom fields, ismael, Toolset
-
AuthorPosts
-
May 6, 2017 at 2:27 pm #788833
Hello,
Iam building a listing site with both Enfold and Toolset types.
While designing a (Toolset) layout to single display custom posts, I’d like to use the Avia gallery to properly display images saved into a custom field (listing-images). I am using the following Avia shortcode to do this:[av_gallery ids='' style='big_thumb' preview_size='portfolio' crop_big_preview_thumbnail='avia-gallery-big-crop-thumb' thumb_size='portfolio' columns='5' imagelink='lightbox' lazyload='avia_lazyload']
, where ids=” could be something like: ids='[wpv-post-field name=’wpcf-listing-images’]’, with a ‘for each’ loop.
So far, I get the gallery to work within the layout but, as it does not know which image to look for, it displays the first images saved into the media library.
Indeed, the normal use of this shortcode is to specify some images from the media library that are then designated with 4digits figures inside the shortcode; f.i. ids= ‘1138,1139,1140’…
So is there any way, instead, to get/embed multiples images saved in a custom field (created with Toolset or otherwise)?Thanks for your help.
May 6, 2017 at 7:17 pm #788887Hey Sim0nb,
There is no easy way to do this in Enfold without extensive theme editing, from the Toolset video: https://vimeo.com/176428571 it seems to show embed multiples images saved in a custom field, perhaps it’s just what your looking for.
Best regards,
MikeMay 7, 2017 at 9:13 am #789063Hey Mike,
Thanks for your hint.
Actually, I have already modified Enfold single.php file and put in child theme so that it can display a customized template (Layout in Toolset parlance) conditionnaly for my custom post type with custom fields; this integrates flawlessly wihin Enfold.
My very specific question is about understanding how I can retrieve/generate those images ids numbers used in the av_gallery shortcode for each posts where images are saved within a custom field, so that I can use this gallery view without having to specify images manually.
I hope you can help me there as it would allow a dynamic use of Enfold brilliant design.Thanks again,
May 9, 2017 at 2:10 am #789934May 9, 2017 at 7:09 am #790015Hi Mike,
Thanks for that.
In the meantime, I think the ‘ids’ numbers actually correspond to the post ID of each image as referred to in the wp_posts table.
I suppose one can dynamically retrieve those based on their post_parent number (the actual post there were attached to).
I’ll look further into it although I am alas no ‘hard core’ programmer so, still, any help is most welcome ;)
Cheers.May 10, 2017 at 8:10 am #790892Hi,
Could you please provide a link to the page where you’re testing this? And post the content of the custom single.php template on pastebin.com. We would like to check it. What value/values does the [wpv-post-field] returns? Maybe, you can assign it as a separate variable. Example:
$images = do_shortcode("[wpv-post-field]"); echo do_shortcode("[av_gallery ids='".$images."' style='big_thumb' preview_size='portfolio' crop_big_preview_thumbnail='avia-gallery-big-crop-thumb' thumb_size='portfolio' columns='5' imagelink='lightbox' lazyload='avia_lazyload']");
Best regards,
IsmaelMay 10, 2017 at 1:13 pm #791058Hello Ismael,
Thanks for the suggestion; the shortcode [wpv-post-field] is not ok for getting images IDs. So I have placed in function php a routine to extract said ids and create a shortcode called [get-images-ids] to enable the display of the Ids list. This works in standalone but not within av-gallery (so far).
Also, I have tried your suggested shortcode in function.php but get the following error:[av_gallery ids='1' style='big_thumb' preview_size='portfolio' crop_big_preview_thumbnail='avia-gallery-big-crop-thumb' thumb_size='portfolio' columns='5' imagelink='lightbox' lazyload='avia_lazyload']
Warning: Cannot modify header information – headers already sent by (output started at /home/mysite/public_html/testbed/wp-content/themes/aja911/functions.php:110) in /home/mysite/public_html/testbed/wp-content/plugins/toolset-module-manager/common/Settings.php on line 78Still it might be the way to go. I have sent you credentials in the private messaging area.
Thanks.- This reply was modified 7 years, 6 months ago by Sim0nb.
May 12, 2017 at 3:27 am #792007Hi,
I’m sorry but I don’t think nested shortcodes are going to work in the plugin’s layout editor. Add the shortcodes in a template file. What value/values does the [wpv-post-field] returns? Please contact the plugin author for additional help.
Best regards,
IsmaelMay 12, 2017 at 1:45 pm #792287Hello Ismael,
Indeed, the solution lied within Toolset plugin; more particularly, I had to register the newly generated shortcode (the one used to extract images ids number suite) within Toolset/settings prior to try embed it into av_gallery shortcode.
Now everything is fine, so you can close this ticket.Thanks for your time
May 13, 2017 at 2:35 pm #792704 -
AuthorPosts
- The topic ‘How to dynamically feed images into Enfold gallery shortcode [av_gallery]?’ is closed to new replies.