php - get gallery images from advanced custom field Editor -
i have created meta box editor using advanced custom field plugin
this meta box displays text editor able create , add gallery post.
but while retrieving gallery data.
$gallery = get_post_meta($post->id, 'gallery', true); echo $gallery; this displays
[gallery ids="53,54,55,56"] generally, gallery data can retrived
$galleries = get_post_gallery_images( get_the_id() ); but not seem work if using meta box save gallery.
is there wordpress way gallery images , loop through them , display image in lightbox or should try other method?
1st assuming had put "[gallery ids="53,54,55,56"]" short code under meta filed why
$gallery = get_post_meta($post->id, 'gallery', true);
echo $gallery;
return
[gallery ids="53,54,55,56"]
can try
$gallery = get_post_meta($post->id, 'gallery', true);
echo do_shortcode($gallery);
and
$galleries = get_post_gallery_images( get_the_id() );
returns list of array of image items image upload sources.
Comments
Post a Comment