Hi,
i am using this code to call gallery:
<?php
$images = get_field('project_gallery');
if( $images ): ?>
<?php foreach( $images as $image ): ?>
<li>
<img src="<?php echo $image['sizes']['galleryImage']; ?>" alt="">
<a href="<?php echo $image['url']; ?>" class="project-caption"><span>+</span></a>
</li>
<!-- // slider -->
<?php endforeach; ?>
<?php endif; ?>
Thumbnails have custom size and thats ok, but i want to set custom size for URL image as well. Dont want to have too big images on click. How can i achieve that?
Thanks
Create another custom image size in WP and then use that size image to link to.
I created new image size, but how to put in image code?
<a href="<?php echo $image['url']; ?>" class="project-caption"><span>+</span></a>
it says URL. thats full size image
The same way your added the custom image URL to the image tag above it
<img src="<?php echo $image['sizes']['galleryImage']; ?>" alt="">
<a href="<?php echo $image['sizes']['OtheCustomImageSize']; ?>" class="project-caption"><span>+</span></a>
When in doubt, you can always output the entire image array to see what’s in it
echo '<pre>'; print_r($image); echo '</pre>';
Thanks ! its working. I tried myself before, same solution but probably i made some error. Thanks again!