Support

Account

Home Forums General Issues Fancybox with simple image

Solved

Fancybox with simple image

  • Hi Im’ using fancybox and a simple acf image (NOT GALLERY)
    My code below is not working i’m looking everywhere but there are mostly gallery fancybox helps.

    So if you have an idea that would be awesome

    <div>
        <a rel="fancybox" href="<?php echo $image['url']; ?>">
        <img src="<?php $image = get_field('photo_2'); echo($image['sizes']['medium']); ?>" alt=""  />   </a>
     </div>
  • Hi Finaly create the solution with a mix of various answers !

    I’ve used :

    <?php 
    $image = get_field('photo_2');
    $image_url = $image['sizes']['medium'];
    if( !empty($image) ): ?>
    
        <a class="fancybox" href="<?php echo $image['url']; ?>">
    	   <img src="<?php echo $image_url; ?>" alt=""  />
    	 </a>
    
    <?php endif; ?>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.