ACF Envira Shortcode

Hi there,

I would like the button below to open the envira lightbox like the link below:

[x_button size="global" block="false" circle="false" icon_only="false" href="#" class="EnviraLink" data-envira-gallery-id="218" title="" target="" info="none" info_place="top" info_trigger="hover" info_content=""]View Photos[/x_button]

Here is the link -

<a href="#" class="EnviraLink" data-envira-gallery-id="218">Click me to open lightbox</a>

Please advise what is wrong with the button code.

Thanks

Hi There,

Button shortcode doesn’t support data-envira-gallery-id option that is why even if we add it will not work. Let’s do the other way around. We will add the class of the button instead to your link so it will look like a button. Link would something like this:

<a href="#" class="EnviraLink x-btn x-btn-global" data-envira-gallery-id="218" style="">Click me to open lightbox</a>

Hope this helps.

Hi Lely,

Thanks for that -

<a href="#" class="EnviraLink x-btn x-btn-global" data-envira-gallery-id="218" style="">Click me to open lightbox</a>

Then is it possible to dynamically change the ‘data-envira-gallery-id’ with the ACF shortcode - ‘gallery_shortcode_id’?

Thanks

Hey there,

It will work as an HTML content and attribute but not an attribute value (inside quotes). You should put the whole attribute and value in the field.

See https://theme.co/apex/forum/t/integrated-plugins-acf-pro/49 for the Cornerstone ACF Integration. I tested the ACF shortcode and it works too.

Hope that helps.