Simple Alt Value for Custom Field
-
Hi there,
So I’m running a loop on a series of custom fields to populate a simple slideshow feature. This is all working fine but the problem I have is that I cannot figure out how to attribute the alt text I have defined when initially uploading images to the media library.
Here’s the code:
<?php $businessimagemain = get_post_meta($post->ID, 'Business image main', false); ?> <?php if ( $businessimagemain ) : ?> <?php foreach($businessimagemain as $businessimagesmain) { $alt_text = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); echo '<img src="'.$businessimagesmain.'" alt="'.$alt_text.'" />'; } ?> <?php else : ?> <p>Slideshow currently unavailble.</p> <?php endif; ?>Any ideas guys?
Cheers
The topic ‘Simple Alt Value for Custom Field’ is closed to new replies.