Reputation: 21
I am trying to get all the gallery images from a single post. Here in get_post_gallery()
the variable $image
returns the thumbnail URL. Can any one help me with retrieving full size image URL from the post.
$gallery = get_post_gallery(get_the_ID(), false )
foreach( $gallery['src'] as $image ) {
$image_list . = '<li>' . $image . '</li>';
}
Upvotes: 2
Views: 5415
Reputation: 51
This work for me:
$gallery = get_post_gallery( $post, false );
$ids = explode( ",", $gallery['ids'] );
foreach( $ids as $id ) {
$link = wp_get_attachment_url( $id );
$image_list . = '<li>' . $link . '</li>';
}
Thanks to Matt for this code, see the original post
Upvotes: 5
Reputation: 554
You can try this
<?php wp_get_attachment_image( $attachment_id, $size, $icon, $attr ); ?>
where you give the attachment id of the gallery image in $attachment_id and $size = (thumbnail, medium, large or full) here basically you choose full as you want to display the full size image. Let me know if this helped you . :)
Upvotes: 0