Support

Account

Home Forums Front-end Issues Images are showing up on frontend Reply To: Images are showing up on frontend

  • Hi Sargamgupta,

    It’s quite hard to read your code, if you highlight it and select the ‘code’ button on the menu above the text box it will display it in a nicer format and make it easier for people to help you 🙂

    It looks like you are returning the alt tag for the image rather than the url, try this instead;

    <?php echo $imgObj['url']; ?>

    You may want to separate your markup from your PHP which will make it again easier to understand, and also wrap and img tag around your output –

    <?php // Show the Gallery
    if( have_rows(‘gallery_slideshow’) ): ?>
    <div class="projects-gallery-wrap">
      <div class="projects-gallery">
    
      <?php // loop through the rows of data
      while ( have_rows(‘gallery_slideshow’) ) : the_row(); ?>
    
        <?php $imgObj = get_sub_field(‘image’, $post->ID); ?>
        <img src="<?php echo $imgObj[url]; ?>" alt="<?php echo $imgObj[alt]; ?>">
    
      <?php endwhile; ?>
    
      </div>
    </div>
    <?php endif; ?>

    You may also want to check you are outputting the image object and not the URL/ID in the backend.

    Let me know how it goes.