is it possible to add a shortcode in the link field of the button widget?
In Elementor I can do that, but in Bricks I do not see this possibility.
I would like to do that, because I would like to change the context for the button link:
Sorry for the late reply. I believe in the link section for the bricks button is all about link generation unlike the elementor counterpart which converts into processing mode for shortcodes.
So, you may:
use url parameters to trigger your shortcode upon button click
use wpajax to execute shortcode upon button click to avoid page refresh
I tried with this script, but it did not work, unfortunately:
<script>
document.addEventListener('DOMContentLoaded', function () {
// Get the button and the original URL
var button = document.getElementById('brxe-svfrkk'); // Button ID
var originalURL = 'https://www.example.com/'; // Original URL
// Execute the shortcode and add the value to the URL when the button is clicked
button.addEventListener('click', function () {
var shortcodeValue = '[jet_engine_data dynamic_field_post_object="post_id" dynamic_field_filter=true filter_callbacks={filter_callback=get_permalink}]#[jet_engine_data dynamic_field_post_object="post_type" object_context="stack_previous"]';// This is the shortcode
var parameter = 'dynamicParameter=' + encodeURIComponent(do_shortcode(shortcodeValue));
var newURL = originalURL + '?' + parameter;
window.location.href = newURL;
});
});
</script>