Trying to :
Insert image ID into a shortcode for UX gallery on Flatsome Theme
Is there any documentation that you are following?
Yes I read through the tickets talking about this issue and I followed this one : https://toolset.com/forums/topic/how-to-get-images-post-id-to-use-with-enfold-gallery/
Website: hidden link
What I did:
I added that code to my function.php file
function prefix_get_img_ids($atts) {
global $post;
$images = (array) get_post_meta($post->ID, 'wpcf-gallery', false); // cast to array in case there is only one item
$ids = array();
global $wpdb;
foreach($images as $img) {
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$img'";
$id = $wpdb->get_var($query);
$ids[] = $id;
}
return implode(", ",$ids);
}
add_shortcode("get-image-ids", "prefix_get_img_ids");
And then used those shortcodes:
[ux_gallery style="none" lightbox_image_size="original" type="masonry" columns="2" ids="[get-image-ids]"]
[gallery ids="[get-image-ids]" orderby="rand" columns="2" size="full" link="none"]
None of them are working (showing random pictures instead. See the result here: hidden link
However, the shortcode [get-image-ids] is working, I have the list of IDs showing up in the right format.
Did I do something wrong inserting the shortcode?
Thank you for your help!
Hi,
Welcome to Toolset support and I'd be happy to assist.
To troubleshoot this, I'll need to see how this gallery page is set up in the admin area.
Can you please share temporary admin login details, in reply to his message?
Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.
regards,
Waqar
My issue is resolved now. Thank you!