Enabling Shortcodes in Divi Module Fields

This post may contain referral links which may earn a commission for this site

Enabling Shortcodes in Divi Module Fields

The Divi Theme's many modules include a variety of fields in which you can enter URLs and text to be displayed by the modules. In many cases, however, these are limited to the static text you type into the modules' settings. What if you want to use be able to dynamically generate the URLs / text using shortcodes, e.g. a URL collected using the Advanced Custom Fields (ACF) plugin? Here's how to do it.

Enable Shortcodes using Divi Shortcode Enabler

Divi Shortcode Enabler is a new plugin I'm working on which aims to provide support for shortcodes in places where Divi does not normally execute them, for example in various Divi module fields.

It's free during early development. There is plenty of scope for improvement, so if it doesn't do what you need, please let me know via the comments below or the contact form and I'll do my best to accommodate it.

Enable Shortcodes via PHP

The following PHP code (taken from my Divi Shortcode Enabler plugin) will search the page / post content for the various module fields, and process any shortcodes contained within them.

With this code in place you should find that shortcodes are now processed within various module fields, including:

    Link
    • Accordion Module
      • Title
    • Blurb Module
      • Title
      • Image
      • URL
    • Button Module
      • Button Text 
      • Button URL
    • Call To Action (CTA) Module
      • Title
      • Button Text
      • Button URL
    • Circle Counter Module
      • Title
      • Number
    • Fullwidth Header Module
      • Title
      • Subheading Text
      • Button #1 Link Text
      • Button #2 Link Text
      • Button #1 Link URL
      • Button #2 Link URL
  • Fullwidth Image Module
    • Image URL
  • Image Module
    • Image URL
    • Link URL
  • Number Counter Module
    • Title
    • Number
  • Pricing Table Module
    • Title
    • Subtitle
    • Button Text
    • Button URL
  • Tab Module
    • Title

Want get more out of Divi?

Hundreds of new features for Divi
in one easy-to-use plugin

46 Comments

  1. Hi dan, I've just purchased the plugin but is there any way we can use customized shortcode.
    I have some shortcode generated by other plugin, I would like to add those shortcodes into the button url but no luck… Can you please advise? Thank you.

    Reply
    • Hi Winson, are you able to tell me the name of the other plugin, and give me an example of the shortcode you're trying to use? How to get it to work will depend on what exactly the shortcode is outputting. Thanks!

      Reply
  2. Oh sorry – Found the link to shortcodes enabler plugin – DOH! Pl delete my ignoramus comment on the divi booster plugin page!

    Reply
    • Ha ha, sure thing, Aveesh! I've deleted the comment. Let me know if you have any questions about the plugin, etc. Thanks!

      Reply
  3. I can't buy this plugin! The checkout process does not work..

    Reply
    • Hi danbilabs, sorry about that. It looks like the caching plugin I use was interfering with the checkout process. I've disabled the caching now. If you'd like to try again, you can do so at:

      https://divibooster.com/divi-shortcode-enabler/

      Give me a shout if you are still unable to get it to work. Thanks!

      Reply
  4. Not working on my divi installation, any help?

    Reply
    • Hi Salvatore, are you able to share a link to the page you're working on and point out where on the page the shortcode is being used? Thanks!

      Reply
  5. Hey Dan,

    If I wanted this to ONLY work in the et_pb_code block, what should my array be?

    Reply
    • Hey Kevin, the Divi Code module (et_pb_code) should process shortcodes by default, so there is no need for the code here. Just put your shortcode in the code module and (as long as the shortcode is defined) it should be processed / displayed. But let me know if you're having trouble getting your shortcode to work in the code module. Cheers!

      Reply
  6. Hi
    Thank you for the post. Any suggestion on how to do this for Fullwidth Header and Fullwidth image? I tried 'et_pb_fullwidth_header' => array('title') but it did not work

    Reply
    • Hey MAK, that should work… I tried it and it works for me. I've updated the post and added an entry for the Fullwidth Image module's Image URL field ("src"). Perhaps you can try copying the full updated code and see if it helps. If not, I've just updated my (currently free) Shortcode Enabler Plugin to include this change, so you may like to give that a go. Assuming you're still having problems with it, is there any chance you're able to send me a link to the page you're working on so that I can take a look? Thanks!

      P.S. If you need support for any other fields in these modules, let me know.

      Reply
      • Dan, I've been trying to get in touch with you for the last week by all means available.

        This plugin isn't working anymore on my Divi, everything is up to date.

        Please contact me asap

        Reply
        • Hi Bob, I'm very sorry I haven't been able to respond to you sooner. I've just released an update to Divi Shortcode Enabler (v1.0.4) which I believe should fix the issue you were having. I hope it helps, but please let me know if not. Thanks!

          Reply
  7. hi !
    great & helpful !

    possible to add circle_counter and number_counter in your array ???

    regards,
    Lamine

    Reply
    • Hi Lamine, I've just updated the code above and the plugin to add support for shortcodes in the title and number fields of the circle / number counter modules. Hope it helps, and let me know if you need anything else. Thanks!

      Reply
  8. Hi Dan. I'm trying to apply a shortcode for a product image in layout builder in Divi Library. I'm guessing this isn't possible right now, meaning the workflow through a pre build layout?

    Reply
    • Hi Matti, you should be able to use this to enable shortcodes in layouts saved to the Divi Library, as long as they are not global library items. Global items are processed differently and my code can't handle them yet. This is something I hope to be able to handle in the future – but for now it isn't possible, unfortunately.

      Another factor is which module you are using to add the product image. If it's the image module the code here should handle it. If it's another module, perhaps you could let me know which module and module field you're using to add the image and I'll see if I can add support for it. Thanks!

      Reply
  9. Holy Sh..! This is unbelievably helpful and you're just frickin' awesome! It is flawless and works spectacularly for making links with affiliate shortcode in them flow nicely from page to page. I am thankful that you are around.

    Reply
    • Ha ha! You're very welcome, Luke!

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Hundreds of new features for Divi
in one easy-to-use plugin

46 Comments

  1. Hi dan, I've just purchased the plugin but is there any way we can use customized shortcode.
    I have some shortcode generated by other plugin, I would like to add those shortcodes into the button url but no luck… Can you please advise? Thank you.

    Reply
    • Hi Winson, are you able to tell me the name of the other plugin, and give me an example of the shortcode you're trying to use? How to get it to work will depend on what exactly the shortcode is outputting. Thanks!

      Reply
  2. Oh sorry – Found the link to shortcodes enabler plugin – DOH! Pl delete my ignoramus comment on the divi booster plugin page!

    Reply
    • Ha ha, sure thing, Aveesh! I've deleted the comment. Let me know if you have any questions about the plugin, etc. Thanks!

      Reply
  3. I can't buy this plugin! The checkout process does not work..

    Reply
    • Hi danbilabs, sorry about that. It looks like the caching plugin I use was interfering with the checkout process. I've disabled the caching now. If you'd like to try again, you can do so at:

      https://divibooster.com/divi-shortcode-enabler/

      Give me a shout if you are still unable to get it to work. Thanks!

      Reply
  4. Not working on my divi installation, any help?

    Reply
    • Hi Salvatore, are you able to share a link to the page you're working on and point out where on the page the shortcode is being used? Thanks!

      Reply
  5. Hey Dan,

    If I wanted this to ONLY work in the et_pb_code block, what should my array be?

    Reply
    • Hey Kevin, the Divi Code module (et_pb_code) should process shortcodes by default, so there is no need for the code here. Just put your shortcode in the code module and (as long as the shortcode is defined) it should be processed / displayed. But let me know if you're having trouble getting your shortcode to work in the code module. Cheers!

      Reply
  6. Hi
    Thank you for the post. Any suggestion on how to do this for Fullwidth Header and Fullwidth image? I tried 'et_pb_fullwidth_header' => array('title') but it did not work

    Reply
    • Hey MAK, that should work… I tried it and it works for me. I've updated the post and added an entry for the Fullwidth Image module's Image URL field ("src"). Perhaps you can try copying the full updated code and see if it helps. If not, I've just updated my (currently free) Shortcode Enabler Plugin to include this change, so you may like to give that a go. Assuming you're still having problems with it, is there any chance you're able to send me a link to the page you're working on so that I can take a look? Thanks!

      P.S. If you need support for any other fields in these modules, let me know.

      Reply
      • Dan, I've been trying to get in touch with you for the last week by all means available.

        This plugin isn't working anymore on my Divi, everything is up to date.

        Please contact me asap

        Reply
        • Hi Bob, I'm very sorry I haven't been able to respond to you sooner. I've just released an update to Divi Shortcode Enabler (v1.0.4) which I believe should fix the issue you were having. I hope it helps, but please let me know if not. Thanks!

          Reply
  7. hi !
    great & helpful !

    possible to add circle_counter and number_counter in your array ???

    regards,
    Lamine

    Reply
    • Hi Lamine, I've just updated the code above and the plugin to add support for shortcodes in the title and number fields of the circle / number counter modules. Hope it helps, and let me know if you need anything else. Thanks!

      Reply
  8. Hi Dan. I'm trying to apply a shortcode for a product image in layout builder in Divi Library. I'm guessing this isn't possible right now, meaning the workflow through a pre build layout?

    Reply
    • Hi Matti, you should be able to use this to enable shortcodes in layouts saved to the Divi Library, as long as they are not global library items. Global items are processed differently and my code can't handle them yet. This is something I hope to be able to handle in the future – but for now it isn't possible, unfortunately.

      Another factor is which module you are using to add the product image. If it's the image module the code here should handle it. If it's another module, perhaps you could let me know which module and module field you're using to add the image and I'll see if I can add support for it. Thanks!

      Reply
  9. Holy Sh..! This is unbelievably helpful and you're just frickin' awesome! It is flawless and works spectacularly for making links with affiliate shortcode in them flow nicely from page to page. I am thankful that you are around.

    Reply
    • Ha ha! You're very welcome, Luke!

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *