Wrap ACF Gallery into Envira Gallery

Hi there,

I would like to wrap the following code into an Envira Gallery. Please advise how -

<?php 
			$image_ids = get_field('room_gallery', false, false);
			$shortcode = '[' . 'gallery ids="' . implode(',', $image_ids) . '"]';

		echo do_shortcode( $shortcode );?>

Hi there,

Thanks for writing in.

I think it’s not possible, I checked their documentation and there is no option for custom query and arguments. It’s heavily dependent on its addons.

You could try Essential Grid instead, like from here https://www.themepunch.com/faq/advanced-additional-parameters/

  1. First, you need to check if it’s your target Grid through ID, if($grid_id == YOUR_GRID_ID)
  2. Then include your gallery images

Option 1: Include all images of the current post


global $post;

$query['post_type'] = 'attachment';
$query['post_mime_type'] = 'image/jpeg,image/gif,image/jpg,image/png';
$query['post_parent'] = $post->ID;
$query['post_status'] = 'inherit';

Option 2: Include all images supplied by ACF field


global $post;

$query['post_type'] = 'attachment';
$query['post_mime_type'] = 'image/jpeg,image/gif,image/jpg,image/png';
$query['post__in'] = get_field('room_gallery', false, false);
$query['post_status'] = 'inherit';

Though, this is just an idea, the whole setup could be complex so I recommend contacting a developer for this implementation.

Thanks!