Get title from attached images
-
Hello,
I’m using the following code to get the attached images from a post, only excluding the featured image.
<?php $thumb_ID = get_post_thumbnail_id( $post->ID ); if ( $images = get_children(array( 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', 'exclude' => $thumb_ID, ))) : ?> <?php foreach( $images as $image ) : ?> <div class="col-sm-4 col-xs-6"> <a class="fancybox-asset" href="<?php echo wp_get_attachment_url($image->ID, 'thumbnail-latest'); ?>" alt="Attached Image Title should be here" title="Attached Image Title should be here"></a> </div> <?php endforeach; ?> <?php else: // No images ?> <?php endif; ?>
What can I do to make it display the image title? (not the post title!)
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Get title from attached images’ is closed to new replies.