Home Forums ACF PRO Help with Gallery field + Simple Lightbox


Help with Gallery field + Simple Lightbox

  • Hello.
    I need some help improving the output of the gallery field so that it is responsive and adding a lightbox effect.

    Below is my code:

    // Load value (array of ids).
    $image_ids = get_field('our_past_work');
    if( $image_ids ) {
        // Generate string of ids ("123,456,789").
        $images_string = implode( ',', $image_ids );
        // Generate and do shortcode.
        // Note: The following string is split to simply prevent our own website from rendering the gallery shortcode.
        $shortcode = sprintf( '[' . 'gallery ids="%s"]', esc_attr($images_string) );
        echo do_shortcode( $shortcode );

    If there is another free plugin i can use apart from Simple Lightbox, i am happy to try it. Thank you in advance.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.