Support

Account

Home Forums Add-ons Gallery Field Returning Image Id's in Order from Gallery Field Reply To: Returning Image Id's in Order from Gallery Field

  • to get ids separated by “,” without trailing “,” you could use:

    <?php $images = get_field('acf-gallery'); 
    if( $images ): 
    $counter = 0;
    foreach( $images as $image ): 
    if ( $counter > 0 ) {echo ',';}
    echo $image['id'];
    $counter++;
    endforeach;
    endif; ?>