Allowing Shortcodes in Divi URLs (Buttons, Images, etc)
The Divi Theme’s many modules offer a range of opportunities for adding URLs to your page. Some examples include the button module and the image module. However these are limited to the static URL you type into the modules’ settings. What if you want to use be able to use URLs dynamically generated by shortcodes, e.g. a URL collected using the Advanced Custom Fields (ACF) plugin? Here’s how to do it.
This is a draft tip, meaning that it hasn't been extensively tested and may not work perfectly.
It is not yet included in Divi Booster, but I hope to be able to do so in the future.
The following PHP code will search the page content for the target URLs of any button and image modules, and process any shortcodes contained within them.
Related Post: Adding PHP to the Divi Theme
With this code in place you should find that shortcodes are now processed within the “Button URL” field of the button module, and the “Link URL” field of the image module.
If there’s any other URL fields you’d like to see this apply to let me know.
Want get more out of Divi?
Hundreds of new features for Divi
in one easy-to-use plugin