WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp_get_attachment_image - How to include alt and title fields? (2 posts)

  1. bmlcreative
    Member
    Posted 4 years ago #

    Hi,

    I'm creating a gallery using the latest aino galleria plugin and have got everything working as I need it to, but when the images are pulled in from WordPress post pages, they are not bringing in the 'alt' and 'title' attributes that I have added. Instead, they are just using the filename of the image.

    I've read that this is an issue with WP and there was a suggestion on WordPress Trac but didn't seem to work and haven't been able to find a fix that works with 3.0.

    Here's what I have inside my loop:

    <div id="portfolioitemcontainer">
    <div class="post" id="post-<?php the_ID(); ?>">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div id="galleria">
           <?php $attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image') );
    	foreach ( $attachments as $attachment_id => $attachment ) {
    	echo wp_get_attachment_image($attachment_id, $size='full', $icon = false);
    	} ?>
    	<?php endwhile; ?>
    	<?php else : ?>
    	<h2>Not Found</h2>
    	<?php endif; ?>
    
        	</div>
            </div>
       </div>

    Any suggestions greatly welcomed...

  2. bmlcreative
    Member
    Posted 4 years ago #

    Ah - hang on a minute - it's all working - seems there was a conflict with the data_config: function(img) within galleria that was stripping any tags. removing that has resolved the issue!

Topic Closed

This topic has been closed to new replies.

About this Topic