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.
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.