Support

Account

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)