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

  • maybe that works:

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