I am trying to use LayerSlider dynamically with my custom post type (Vrata) where each single post (door product) has its own content managed with ACF fields.
On each single Vrata post, display a LayerSlider that pulls the correct door image (PNG) and dynamic text fields from ACF.
I want LayerSlider to change based on the current post being viewed (so if post A has a white door and post B has a black door, the slider should reflect that automatically).
Ideally, this would allow me to animate the door PNG inside LayerSlider, while still pulling the correct image/text from the current post.
The issues I am running into:
The [meta:fieldname] placeholder does not properly return the ACF image field value (it either outputs 989 or doesn’t render the image at all).
Using [image] only pulls the featured image, but it seems to always display the same image across different posts, not the correct one for each post.
I tried editing my theme templates (single.php, single-vrata.php) to pass the post_id into the shortcode like this:
But my theme (Royal Elementor Kit) seems to ignore these templates and instead relies on Elementor’s Theme Builder for single posts. That means I can’t confirm if LayerSlider is picking up the post context.
My main question: How can I make LayerSlider reliably pull the correct ACF fields (images and text) for the current post being viewed in a Single Post template?
I need to know if:
LayerSlider can directly recognize the current post context when embedded in Elementor’s Single Post template.
Or if I must pass the post_id somehow.
Or if this is a known limitation and I need a different approach.
Any guidance or code snippet from your side would help a lot, I’ve invested in LayerSlider specifically for its animation capabilities, and I just need to connect it properly to my ACF data.
Thank you for reaching out to us. My name is John, and I'm happy to assist you. I sincerely appreciate your patience while we worked to get back to you.
LayerSlider does not accept a post_id attribute in its shortcode, so you cannot manually pass the context that way. Fortunately, that is not a problem, since the plugin automatically relies on get_the_ID() to determine the current post, and it should already receive the correct post context without any extra configuration.
The issue comes from how ACF fields are handled. Standard text fields work as expected, but image fields return an attachment ID. LayerSlider does not have built-in logic to turn that ID into a usable image URL, so instead of displaying the image, it shows the raw number or nothing at all. This is simply a limitation of the current version, as there is no dedicated ACF integration yet.
A practical workaround is to add a small custom shortcode in your theme or a helper plugin. That shortcode can fetch the ACF image field for the current post and return the actual image URL. You can then insert this shortcode in the LayerSlider image or background fields, and it will correctly output the image linked to each post. This way, you can still connect your ACF content with LayerSlider's animation features until native support is available.
Yes, that code looks good and it should work as intended. Since ACF's get_field() function pulls data from the current post in the loop, you generally do not need to pass a post ID manually. Because LayerSlider executes the shortcode exactly where you place the slider, the post context of that page will naturally apply.
To insert the shortcode, you can right-click on LayerSlider's image pickers (e.g., slide background) and choose the "Enter from URL" option. Paste your shortcode there, and it will resolve on the front end when the slider is embedded on the page. Just keep in mind that the result is only visible in the live slider, not inside the editor preview.
I’ve successfully created a shortcode that outputs my ACF image field as an <img> tag. Example:
function acf_image_url_shortcode($atts) { $atts = shortcode_atts( array( 'field' => '', 'size' => 'full', ), $atts );
if (empty($atts['field'])) return '';
$image_id = get_field($atts['field']); if (!$image_id) return '';
$image_url = wp_get_attachment_image_url($image_id, $atts['size']);
// Instead of just URL, return a real IMG tag return '<img src="' . esc_url($image_url) . '" alt="" />';
}
add_shortcode('acf_image_url', 'acf_image_url_shortcode');
When I use it in a LayerSlider Text/Dynamic Layer, it works perfectly:
[acf_image_url field="vrata_slider"]
However, I cannot use the same logic in Image Layers. LS seems to ignore shortcodes inside media['image'] fields and treats them as plain text, so the image never loads.
Could you please confirm if LayerSlider officially supports evaluating shortcodes inside image/background fields? Or is a filter like this (running do_shortcode() on media['image']) the only way to make it work?
This is the final missing piece for making my single CPT pages fully dynamic. Any guidance would be greatly appreciated.
You are absolutely right, Zoran. At the moment, shortcodes are evaluated in slide backgrounds, slide thumbnails, and layer backgrounds, but not in image layers. That omission has already been addressed in our development build, and full shortcode support for image layers will be part of the upcoming release.
This next update is a major one with many new features, so we will first publish it as a beta version even though it is considered stable. If you would like early access, you can switch your release channel to "Beta" in the Plugin Updates box. We plan to make the beta available later this week.
In the meantime, the workaround you discovered is perfectly valid and produces the same end result as an image layer would. Thank you again for reporting this and for the proactive way you approached the issue. Your solution was spot on!
Thank you so much for all your support and the clear explanations throughout this process. It really helped me understand what was going on under the hood with LayerSlider and ACF.
I’ll keep using the current workaround for now, and I’ll count on the beta release at the end of this week to finally start using dynamic images directly inside image layers across my LayerSlider-powered websites. Really looking forward to testing it out once it drops.
Thanks again for the assistance and for the proactive improvements you and the team are making to LayerSlider!
Best regards,
Zoran
P.S. Please let me know if the beta timing changes so I can plan around it.
Thank you for your kind words, Zoran. We truly appreciate it!
Unfortunately, the beta was delayed slightly, but it should be released in the coming days, likely early next week. I'll get back to you and send another message once it's out.
Thanks again for rolling out the beta with shortcode support for image layers — that’s great news!
I just have a few quick clarifications so I can test it properly:
When using an ACF image field, what should I set as the return format — Image Array, Image URL, or Image ID?
Does this shortcode functionality work for ACF image fields as well (not just the default WordPress “Featured Image”)?
Do I need to add any additional code via a Code Snippets / PHP function, or will the shortcode work out of the box?
For example, if I add [acf field="image_field"] inside the Image URL field in LayerSlider, should it now dynamically pull that image, and which ACF return format does it expect?
I’d really appreciate it if you could confirm the correct syntax and setup so I can test it properly.
Thanks again for all your support and the ongoing improvements!
A more in-depth ACF support is yet to be added to LayerSlider. As before, LayerSlider supports basic textual fields. This update only changes that image layers now correctly process shortcodes, and you no longer need to make workarounds, such as using a Dynamic Layer with custom HTML.
If you're using your own custom shortcode, you can process anything the way you want to deal with them. LayerSlider expects the shortcode to return an image URL. ACF's own shortcode should also support that if you select Image URL as the return format.
There's no change on that front. We'll likely introduce dedicated ACF-based post placeholders to address this in the future. The default [image] placeholder will always use the Featured Image, since the two aren't interchangeable in any way.
It depends on what shortcode you're using. As suggested above, ACF's own shortcode should also work with the right return format selected, but in the past, you used your own shortcode, which required a little PHP code snippet.
This conversation was very helpful, and maybe could majorly help anyone looking for the same solution since there is not a clear GUI formed about this, anyhow everything works nicely.
Unfortunately the dynamic layer - [title] does not work, it stays the same on all of my ACF 'single' pages. (Despite the dynamic image working - it changes) , it takes the last post's title.
Is there a quick fix for this? I tried clearing my cache, flushing the permalinks & reinserting the slider via shortcode.
I'm sorry you're experiencing this issue. The [title] dynamic post placeholder should follow the current post context correctly, and it works as expected on our end. To investigate further, we'll need a bit more detail about your setup. Could you let us know if this is used on a custom post type, and what exactly you mean by "single pages"? This will help us understand why the title might not be updating.
The 'Single' page term that I'm referring to is the page (template) with all the ACF fields, so: ACF Post type -> Single page(and there's the LayerSlider's Shortcode)
Honestly I'm not sure why it isn't working, it did and it stopped. If you would like to request any screenshots or codes.
The [title] placeholder itself works correctly in LayerSlider based on our tests. We couldn't reproduce the issue on our end, and nobody else has reported a similar problem. It also worked for you previously. Because of that, it's very likely that the change is caused by something external, most likely related to where/how the slider is embedded or what runs right before it on the page.
To properly check what's happening in your setup, please send us a temporary WP admin login so we can take a direct look at how LayerSlider is used there. Make sure to reply privately if your message contains sensitive information.
Hello,
I am trying to use LayerSlider dynamically with my custom post type (Vrata) where each single post (door product) has its own content managed with ACF fields.
>CLEAR IMAGE BASED PROBLEM EXPLANATION LINK
My goal:
On each single Vrata post, display a LayerSlider that pulls the correct door image (PNG) and dynamic text fields from ACF.
I want LayerSlider to change based on the current post being viewed (so if post A has a white door and post B has a black door, the slider should reflect that automatically).
Ideally, this would allow me to animate the door PNG inside LayerSlider, while still pulling the correct image/text from the current post.
The issues I am running into:
The [meta:fieldname] placeholder does not properly return the ACF image field value (it either outputs 989 or doesn’t render the image at all).
Using [image] only pulls the featured image, but it seems to always display the same image across different posts, not the correct one for each post.
I tried editing my theme templates (single.php, single-vrata.php) to pass the post_id into the shortcode like this:
echo do_shortcode('[layerslider id="2" post_id="' . get_the_ID() . '"]');But my theme (Royal Elementor Kit) seems to ignore these templates and instead relies on Elementor’s Theme Builder for single posts. That means I can’t confirm if LayerSlider is picking up the post context.
My main question:
How can I make LayerSlider reliably pull the correct ACF fields (images and text) for the current post being viewed in a Single Post template?
I need to know if:
LayerSlider can directly recognize the current post context when embedded in Elementor’s Single Post template.
Or if I must pass the post_id somehow.
Or if this is a known limitation and I need a different approach.
Any guidance or code snippet from your side would help a lot, I’ve invested in LayerSlider specifically for its animation capabilities, and I just need to connect it properly to my ACF data.
Thank you in advance for your support!
Kind regards,
Zoran
Hi Zoran,
Thank you for reaching out to us. My name is John, and I'm happy to assist you. I sincerely appreciate your patience while we worked to get back to you.
LayerSlider does not accept a post_id attribute in its shortcode, so you cannot manually pass the context that way. Fortunately, that is not a problem, since the plugin automatically relies on get_the_ID() to determine the current post, and it should already receive the correct post context without any extra configuration.
The issue comes from how ACF fields are handled. Standard text fields work as expected, but image fields return an attachment ID. LayerSlider does not have built-in logic to turn that ID into a usable image URL, so instead of displaying the image, it shows the raw number or nothing at all. This is simply a limitation of the current version, as there is no dedicated ACF integration yet.
A practical workaround is to add a small custom shortcode in your theme or a helper plugin. That shortcode can fetch the ACF image field for the current post and return the actual image URL. You can then insert this shortcode in the LayerSlider image or background fields, and it will correctly output the image linked to each post. This way, you can still connect your ACF content with LayerSlider's animation features until native support is available.
Best Regards,
John | Kreatura Dev Team
Hi John,
Thank you very much for clarifying. That makes sense now ,I see why the [meta:fieldname] placeholder only returns the numeric ID for images.
I like your suggestion of using a helper shortcode. Could you please confirm if something like this would work?
function acf_image_url_shortcode($atts) { $atts = shortcode_atts( array( 'field' => '', 'size' => 'full', ), $atts ); if (empty($atts['field'])) return ''; $image_id = get_field($atts['field']); if (!$image_id) return ''; $image_url = wp_get_attachment_image_url($image_id, $atts['size']); return esc_url($image_url); } add_shortcode('acf_image_url', 'acf_image_url_shortcode');Then in LayerSlider I’d call:
Would that be the correct approach?
Also, would this method still respect the current post context automatically, without needing to pass post_id manually?
Thanks again for your help!
Kind regards,
Zoran
Yes, that code looks good and it should work as intended. Since ACF's get_field() function pulls data from the current post in the loop, you generally do not need to pass a post ID manually. Because LayerSlider executes the shortcode exactly where you place the slider, the post context of that page will naturally apply.
To insert the shortcode, you can right-click on LayerSlider's image pickers (e.g., slide background) and choose the "Enter from URL" option. Paste your shortcode there, and it will resolve on the front end when the slider is embedded on the page. Just keep in mind that the result is only visible in the live slider, not inside the editor preview.
Best Regards,
John | Kreatura Dev Team
Hello again,
I’ve successfully created a shortcode that outputs my ACF image field as an <img> tag. Example:
function acf_image_url_shortcode($atts) { $atts = shortcode_atts( array( 'field' => '', 'size' => 'full', ), $atts ); if (empty($atts['field'])) return ''; $image_id = get_field($atts['field']); if (!$image_id) return ''; $image_url = wp_get_attachment_image_url($image_id, $atts['size']); // Instead of just URL, return a real IMG tag return '<img src="' . esc_url($image_url) . '" alt="" />'; } add_shortcode('acf_image_url', 'acf_image_url_shortcode');When I use it in a LayerSlider Text/Dynamic Layer, it works perfectly:
However, I cannot use the same logic in Image Layers. LS seems to ignore shortcodes inside media['image'] fields and treats them as plain text, so the image never loads.
Could you please confirm if LayerSlider officially supports evaluating shortcodes inside image/background fields? Or is a filter like this (running do_shortcode() on media['image']) the only way to make it work?
This is the final missing piece for making my single CPT pages fully dynamic. Any guidance would be greatly appreciated.
INSPECT EL. ERROR LOG IMG
Thank you,
Zoran
You are absolutely right, Zoran. At the moment, shortcodes are evaluated in slide backgrounds, slide thumbnails, and layer backgrounds, but not in image layers. That omission has already been addressed in our development build, and full shortcode support for image layers will be part of the upcoming release.
This next update is a major one with many new features, so we will first publish it as a beta version even though it is considered stable. If you would like early access, you can switch your release channel to "Beta" in the Plugin Updates box. We plan to make the beta available later this week.
In the meantime, the workaround you discovered is perfectly valid and produces the same end result as an image layer would. Thank you again for reporting this and for the proactive way you approached the issue. Your solution was spot on!
Best Regards,
John | Kreatura Dev Team
Thank you so much for all your support and the clear explanations throughout this process. It really helped me understand what was going on under the hood with LayerSlider and ACF.
I’ll keep using the current workaround for now, and I’ll count on the beta release at the end of this week to finally start using dynamic images directly inside image layers across my LayerSlider-powered websites. Really looking forward to testing it out once it drops.
Thanks again for the assistance and for the proactive improvements you and the team are making to LayerSlider!
Best regards,
Zoran
P.S. Please let me know if the beta timing changes so I can plan around it.
Thank you for your kind words, Zoran. We truly appreciate it!
Unfortunately, the beta was delayed slightly, but it should be released in the coming days, likely early next week. I'll get back to you and send another message once it's out.
Best Regards,
John | Kreatura Dev Team
Hi Zoran,
The beta release is out now with the promised shortcode handling for image layers. Please let me know if you have questions or encounter any issues.
Best Regards,
John | Kreatura Dev Team
Hi John,
Thanks again for rolling out the beta with shortcode support for image layers — that’s great news!
I just have a few quick clarifications so I can test it properly:
When using an ACF image field, what should I set as the return format — Image Array, Image URL, or Image ID?
Does this shortcode functionality work for ACF image fields as well (not just the default WordPress “Featured Image”)?
Do I need to add any additional code via a Code Snippets / PHP function, or will the shortcode work out of the box?
For example, if I add [acf field="image_field"] inside the Image URL field in LayerSlider, should it now dynamically pull that image, and which ACF return format does it expect?
I’d really appreciate it if you could confirm the correct syntax and setup so I can test it properly.
Thanks again for all your support and the ongoing improvements!
Best regards,
Zoran
A more in-depth ACF support is yet to be added to LayerSlider. As before, LayerSlider supports basic textual fields. This update only changes that image layers now correctly process shortcodes, and you no longer need to make workarounds, such as using a Dynamic Layer with custom HTML.
Best Regards,
John | Kreatura Dev Team
Quick reply - Worked.
This conversation was very helpful, and maybe could majorly help anyone looking for the same solution since there is not a clear GUI formed about this, anyhow everything works nicely.
Hi,
Unfortunately the dynamic layer - [title] does not work, it stays the same on all of my ACF 'single' pages. (Despite the dynamic image working - it changes) , it takes the last post's title.
Is there a quick fix for this? I tried clearing my cache, flushing the permalinks & reinserting the slider via shortcode.
Thank you
I'm sorry you're experiencing this issue. The [title] dynamic post placeholder should follow the current post context correctly, and it works as expected on our end. To investigate further, we'll need a bit more detail about your setup. Could you let us know if this is used on a custom post type, and what exactly you mean by "single pages"? This will help us understand why the title might not be updating.
Best Regards,
John | Kreatura Dev Team
The 'Single' page term that I'm referring to is the page (template) with all the ACF fields, so: ACF Post type -> Single page(and there's the LayerSlider's Shortcode)
Honestly I'm not sure why it isn't working, it did and it stopped. If you would like to request any screenshots or codes.
Attached files: image (2).png
Thank you for the details, Zoran.
The [title] placeholder itself works correctly in LayerSlider based on our tests. We couldn't reproduce the issue on our end, and nobody else has reported a similar problem. It also worked for you previously. Because of that, it's very likely that the change is caused by something external, most likely related to where/how the slider is embedded or what runs right before it on the page.
To properly check what's happening in your setup, please send us a temporary WP admin login so we can take a direct look at how LayerSlider is used there. Make sure to reply privately if your message contains sensitive information.
Best Regards,
John | Kreatura Dev Team