Support ACF Photo Gallery

Got it working!!!

1.5 RC fixed the ‘Output PHP Function’ dynamic data option behavior so now you can write function like this:

function get_portfolio_gallery(){
    
    //Get the ID of the portfolio item currently in loop
    $portolio_id = get_the_ID(); 
    
    //Get the image array that is attached to this portfolio item
    $portfolio_gallery = acf_photo_gallery('test_gal', $portolio_id);
    
    //Get only IDs of these images as this is what Carousel and Gallery elements expect to get
    $gallery_img_ids = array_column($portfolio_gallery, 'id');
    
    return $gallery_img_ids;
}

I have ACF Photo Gallery field called ‘test_gal’ attached to portfolio CPT.

I use it in the query loop that outputs portfolio items. There I have a Carousel element which is set like this after using ‘Output PHP Function’ dynamic data option

image

Works like a charm. Also tested with Gallery element.

I tag you all, so you don’t miss this fix among other 100 :wink: @danny-errnerr @nirose @bricksandmortar

8 Likes