Support

Account

Home Forums General Issues Image link to attachment page Reply To: Image link to attachment page

  • You’re going to need to alter the field so that it returns the attachment ID instead of the URL. For more information see WP doc for the functions I use here.

    
    <?php 
    
    $images = get_field('galerie_bd');
    
    if( $images ): ?>
    <ul class="rslides">
            <?php foreach( $images as $image ): ?>
                <li>
                    <a href="<?php echo get_attachment_link($image); ?>">
                         <?php 
                             $size = 'thumbnail';
                             $attach = wp_get_attachment_image_src($image, $size);
                         ?>
                         <img src="<?php echo $attach[0]; ? />" />
                    </a>
                                </li>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>