I'm using the meta-box framework from http://bit.ly/HPdJyS, everything works fine. I'm using it to create gallery function on some custom post type, and I'm able to display the uploaded images using this code:
global $wpdb;
$meta = get_post_meta( get_the_ID(), 'meta_key', false );
if ( ! is_array( $meta ) )
$meta = ( array ) $meta;
if ( ! empty( $meta ) )
{
$meta = implode( ',', $meta );
$images = $wpdb->get_col( "
SELECT ID FROM {$wpdb->posts}
WHERE post_type = 'attachment'
AND ID IN ( {$meta} )
ORDER BY menu_order ASC
" );
foreach ( $images as $att )
{
// Get image's source based on size, can be 'thumbnail', 'medium', 'large', 'full' or registed post thumbnails sizes
$src = wp_get_attachment_image_src( $att, 'full' );
$src = $src[0];
// Show image
echo "<img src='{$src}' />";
}
}
The images are shown, but I want to also display the captions from each picture. How can I do it?