Media query and Nestable slider (acf/ JetEngine gallery field)

Hi,
This code works , it is modified for jetengine.
In field settings, select value format as Array with media ID and URL

$jetengine_images = get_post_meta( get_the_ID(), 'my-galerie', true );

// Check if the array is not empty
if (!empty($jetengine_images)) {
    // Extract only the IDs of the images
    $image_ids = array_map(function($item) {
        return $item['id']; // Ensure that the key for IDs is correct
    }, $jetengine_images);

    // Use these IDs in the WP_Query
    return [
        'post_type'      => 'attachment',
        'post_mime_type' => 'image',
        'post_status'    => 'inherit',
        'orderby'        => 'post__in',
        'post__in'       => $image_ids,
        'posts_per_page' => -1,
    ];
} else {
    return [];
}

Thanks.

1 Like