Support

Account

Home Forums Add-ons Repeater Field Add alt tag to image rotator

Solving

Add alt tag to image rotator

  • Hi Guys,

    I need to add the alt tag to this code for a image repeater on the front page of this website: http://tedswoodshop.com, I have followed several tutorials, but can’t seem to get it right.

    	<?php get_the_image( array( 'meta_key' => 'Feature', 'image_class' => 'border', 'size' => 'full', 'width' => '930', 'link_to_post' => false ) ); ?>
    <div id="homeRotator">
    <?php $values = array();
    	while(the_repeater_field('rotator_images')):
    	$values[] = get_sub_field('rotator_image');
    	endwhile;
    	shuffle($values);
    	foreach ($values as $value) :
    		$size = "full";
    		$image = wp_get_attachment_image_src($value,$size); ?>
    	<img src="<?php echo $image[0]; ?>" />
    <?php endforeach; ?>
    </div>

    Thanks for your help

  • This reply has been marked as private.
  • 
    <?php get_the_image( array( 'meta_key' => 'Feature', 'image_class' => 'border', 'size' => 'full', 'width' => '930', 'link_to_post' => false ) ); ?>
    <div id="homeRotator">
    <?php $values = array();
    	while(the_repeater_field('rotator_images')):
    	$values[] = get_sub_field('rotator_image');
    	endwhile;
    	shuffle($values);
    	foreach ($values as $value) :
    		$size = "full";
    		$image = wp_get_attachment_image_src($value,$size); ?>
    <!-- Add Alt Tag -->
    	<img src="<?php echo $image[0]; ?>" alt="your text here" />
    <?php endforeach; ?>
    </div>
    
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Add alt tag to image rotator’ is closed to new replies.