• Resolved zhuraavl

    (@zhuraavl)


    What do I need to add to this to display caption text that can be set in the admin panel when I add a photo to gallery?

    
    $galleryArray = get_post_gallery_ids(); 
    
    foreach ( $galleryArray as $id ) {
    
        echo '<img src="' . wp_get_attachment_url( $id ) .'">';
    
    }
    
Viewing 1 replies (of 1 total)
  • Plugin Author Andy Mercer

    (@kelderic)

    Hi there, zhuraavl,

    To get the caption, you’ll use the wp_get_attachment_caption function. You’d pass it the ID as a parameter, in the same way that you pass the ID to wp_get_attachment_url.

Viewing 1 replies (of 1 total)
  • The topic ‘How to get caption?’ is closed to new replies.