Home › Forums › Add-ons › Gallery Field › First image in gallery bigger › Reply To: First image in gallery bigger
i would recommend do something like that:
<?php
$images = get_field('gallery');
$img_count=1;
if( $images ): ?>
<?php foreach( $images as $image ):
if ($img_count == 1) { ?>
<div class="large">
<a rel="gallery" href="<?php echo $image['url']; ?>">
<img src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['alt']; ?>" />
</a>
</div>
<?php } else {?>
<div class="thumb">
<a rel="gallery" href="<?php echo $image['url']; ?>">
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
</a>
</div>
<?php }
$img_count++; ?>
<?php endforeach; ?>
<?php endif; ?>
instead of trying to use css only.
you probably need to add a popup-script like fancybox too, to get a result like your example.
(with help of css3, it should be possible for new browsers, to do a css only solution. look at :first-of-type for example, but i would not recommend that)
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.