Support

Account

Home Forums Add-ons Repeater Field Getting Alt Text to show up in Image Field Reply To: Getting Alt Text to show up in Image Field

  • Thanks…

    So I tried it both ways, but maybe I’m not understanding the second part (getting the alt text to work).

    I tried

    <?php get_header(); ?>
    
    <div id="gallery-content">
    
    	<h1><?php the_title(); ?></h1>
    	
    	<p><?php the_field('gallery_info'); ?></p>
    	
    	<?php if(get_field('gallery_images')): ?>
        <?php while(the_repeater_field('gallery_images')): ?>
    
            <?php $image = wp_get_attachment_image_src(get_sub_field('image', false), 'gallery'); ?>
            <?php $image2 = wp_get_attachment_image_src(get_sub_field('image', false), 'full'); ?>
            <a href="<?php echo $image2[0]; ?>" rel="shadowbox[gallery]"><img class="gallery-images" src="<?php echo $image[0]; ?>" alt="<?php echo $image[β€˜alt’]; ?>” /a>
    
        <?php endwhile; endif; ?>

    And

    <?php get_header(); ?>
    
    <div id="gallery-content">
    
    	<h1><?php the_title(); ?></h1>
    	
    	<p><?php the_field('gallery_info'); ?></p>
    	
    	<?php if(get_field('gallery_images')): ?>
        <?php while(the_repeater_field('gallery_images')): ?>
    
            <?php $image = wp_get_attachment_image_src(get_sub_field('image', false), 'gallery'); ?>
            <?php $image2 = wp_get_attachment_image_src(get_sub_field('image', false), 'full'); ?>
            <a href="<?php echo $image2[0]; ?>" rel="shadowbox[gallery]"><img class="gallery-images" src="<?php echo $image[0]; ?>" $alt = get_post_meta(get_sub_field(image), '_wp_attachment_image_alt', true); ?>” /a>
    
        <?php endwhile; endif; ?>

    Both options give code links instead of images on the gallery page. Can you see something I’m doing wrong? Thanks!