Use Shortcodes within Divi Module fields
The plugin detects and runs shortcodes in various Divi Builder module fields, including:
- Accordion Module
- Title
- Bar Counter Module
- Percent
- Blurb Module
- Title
- Image
- URL
- Alt
- Button Module
- Button TextÂ
- Button URL
- Call To Action (CTA) Module
- Title
- Button Text
- Button URL
- Circle Counter Module
- Title
- Number
- Columns
- Column Link URL
- Contact Form Module
- Redirect URL
- Success Message
- Message Pattern
- Field Titles (Placeholder)
- 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
- Title Text
- Alt
- Image Module
- Image URL
- Link URL
- Title Text
- Alt
- Number Counter Module
- Title
- Number
- Pricing Table Module
- Title
- Subtitle
- Currency
- Sum
- Frequency
- Button Text
- Button URL
- Rows
- Row Link URL
- Slider Module Slides
- Title
- Button Text
- Button URL
- Title Text
- Alt
- Social Media Follow Module
- Account Link URL
- Tab Module
- Title
- Toggle Module
- Title
- All Modules, Rows and Sections
- Background Image URL
- Module Link URL
- CSS ID
- CSS Class
- Third-Party Plugins
- Divi Areas Pro - Section Popup ID
- Divi Supreme Pro - Card Carousel Module Image
Built-In Shortcodes
The plugin includes the following shortcodes for use in the module fields:
- [site_url] – Adds the site URL (no trailing slash). Useful for ensuring that your URLs always point to the correct site, even if you change domains / move your site.
- [dbsce_post_id] – Returns the current post id.
- [dbsce_echo_test] – Returns the text "test". Useful for checking if shortcodes are being processed.
- [custom_field name="xxx" post_id="yyy"] – Returns the value of the custom field named "xxx" set in the page / post with id "yyy" (defaults to current page / post if post_id attribute omitted).
Can i you my own shortcodes?
Hi Jonas. Yes, you can use your own shortcodes with Divi Shortcode Enabler. To do so, you need to first add your shortcode to WordPress, e.g. by entering its PHP code into the functions.php of your child theme (if you're using one) or using a plugin such as Code Snippets. Then you can just enter your shortcode into the button module field you want to use it in.
The main requirement for this to work is that your shortcode returns a valid value (and nothing else) for the field it is being used in. So if you want to use it, say, in the Button Link URL field, it should return a valid URL only – it shouldn't, for example, return any HTML tags with that. Note that if you want to display some HTML content in a popup when the button is clicked, then Divi Shortcode Popup Module may be the better plugin for you.
If you'd like some help with the, please feel free to send through some details of the shortcode (e.g. its PHP code) and any errors you're getting when you use it. Thanks!