Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

AvWijk on "Get title from attached images"

$
0
0

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 all articles
Browse latest Browse all 8245

Trending Articles