Support

Account

Home Forums General Issues Image size: attachment display settings Reply To: Image size: attachment display settings

  • Still searching to do this with the gallery field add on… cannot make something work. Will be easier I guess with a repeater field.
    The difficulty I think is how to get the attachement id for each image as the gallery field call for all pictures $attachment_id = get_field('gallery');' not working. So I tried this:

    <?php
    /*
    *  Gallery
    */
    // url = $image[0];
    
    $images = get_field('gallery');
    $field = get_field_object('size-gallery');
    $value = get_field('size-gallery');
    $label = $field['choices'][ $value ];
     
    if( $images ): ?>
                    <?php foreach( $images as $image ): ?>
    				<?php $image2 = wp_get_attachment_image_src( $image['id'], $label ); ?>
    <li>
    			<a href="<?php echo $image2[0]; ?>" class="fancybox" rel="gallery" title=""><div class="miniature"><img src="<?php echo $image2[0]; ?>" /></div></a>
    		</li>
            
    	            <?php endforeach; ?>
    <?php endif; ?><!--FIN DE GALERIE PHOTOS -->

    The gallery works but the $label has no effect.

    Any idea would be great. I really need to make it works. Thanks