Home › Forums › Add-ons › Gallery Field › How to Remove last comma from Gallery Loop? › Reply To: How to Remove last comma from Gallery Loop?
@hube2 Please, could you show me with an example of my code, the fact is that I barely understand what you are talking about, since I don’t understand PHP very well
<img class="location__image" src="<?php echo get_the_post_thumbnail_url(
get_the_ID(),
"medium_large"
); ?>"
data-hover-slides='<?php
$location_gallery_images = get_field("location_gallery");
if ($location_gallery_images):
foreach (
array_slice($location_gallery_images, 0, 5)
as $location_gallery_image
):
echo esc_url(
$location_gallery_image["sizes"]["medium_large"]
); ?>, <?php
endforeach;
endif;
?>'>
I will be very grateful to you! and even more today I will pray for you in church and light a candle)
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.