How To Add Shortcodes In Divi Tutorial by Pee-Aye Creative

How To Add Shortcodes In Divi

Learn how to add shortcodes from any plugin in the Divi Builder and place the shortcode a Divi module anywhere in your layout.

Add Shortcode In A Text Module

The Best Method For Adding Shortcodes In Divi

The best method we can use to add a shortcode anywhere in our Divi layout is to use the Text module. If this surprises you, just remember that the text module is bascially an HTML module. When you switch from the Visual tab to the Text tab within the Text module, you can seee the HTML markup.

To add your shortocode, just go to whichever WordPress plugin you have installed that generates the shortcode and copy it. Then go to your Divi Visual Builder and add a Text module. Paste the shortcode there, and your shortcode will render the design of the WordPress plugin features.

Styling The Shortcode

Depending on what the shortcode does or how it is made, you may be able to style certain parts of it using the Divi Builder. For example, if there are any headings or paragraph text elements, you  can use the settings in the Design tab to style those. All of these extra feature are why I rececommend using the Text module as apposed to the Code module.

Add Shortcode In Code Module

Alternative method For Adding Shortcodes In Divi

Another very limited method we can use to add a shortcode anywhere in our Divi layout is to use the Code module. I don’t know why you would want ot use this, but I’ve seen people who do, so here it is.

To use this module, just copy the shortcode from the WordPress plugin you are using that generated the shortcode. Then go to your Divi Visual Builder and add a Code module. Paste the shortcode there, and your shortcode will render the design of the WordPress plugin features.

Last updated Jan 3, 2021 @ 12:17 pm

Please share this post!

Nelson Lee Miller (aka The Divi Teacher)

Nelson is the owner of Pee-Aye Creative Co in the beautiful state of Pennsylvania. He loves helping small businesses, exploring, building websites with Divi, and teaching others.
Divi Adventure Club Product And Course Membership by Pee Aye Creative

Become A Member!

Gain access to everything we offer!

Learn More

Leave A Response!


  1. Vyshnav

    When i add a textbox and button using shortcode(written in functions.php) it always shows at the top of website, In divi visual builder it was placed at bottom, but regardless where it placed on visual builder on front-end it display on the top.

      • Vyshnav

        Thanks for the response, it was mistake in the shortcode i wrote.
        I wrote shortcode without using ob_start()/ob_get_clean().
        Your methods mentioned above works perfectly 😊😊

      • Stephen

        YES! I was stuck on this problem as well. You might want to update the article to specifically talk about ob_start()/ob_get_clean().

  2. Dom

    Hi Nelson,

    How do you add a shortcode to a button module URL field? I have been using a work around by using a text module – styling the text to look like a button – but would prefer to use the button module.


    • Nelson Lee Miller (aka The Divi Teacher)

      Hi Dom,
      I don’t know what you mean about adding a shortcode to a button URL field. That doesn’t really make any sense. Can you explain what you are trying to occomplish?

      • Dom

        As an example I recently helped a friend with his site which uses the food menu system. They give you the option to use a button they have created to show a pop-up food / takeway menu. As their button was very different from the divi buttons he has on his site, and their styler is very basic, I tried to add the shortcode they provide to a divi button URL field (also removing their class glf-btn-basic)

        [restaurant-menu-and-ordering class=”glf-btn-basic” ruid=”xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”]

        It did not work so I had to create a button using a text module, using the shortcode as the URL, and it worked fine. My question is, is their anyway to add shortcodes like this to the divi button module URL field. It obviously calls up a javascript popup menu and then populates it with the menu items via the ruid number.

  3. Steve

    Thanks for the tutorial.

    I created a template in the theme builder for a product. I do not want to use the standard Woo Tabs as they are inadequate. There’s a tab plugin that generates a shortcode that I’d like to use for each product and it be unique for each product. The goal was to be able to do it dynamically.

    I have tried with ACF creating a custom field in almost every format (ie Text, text area wziswyg etc) for the field and added the shortcode to that field.

    I the theme template page I added a text module and added the dynamic field (shortcode) I created for the product, but no matter what I do, it doesn’t show up. Depending on the format of the field, it will show up as a bunch of commands, but not the Tabs from the shortcode. If I add a code module with the shortcode, the tabs show up.

    Is there a way to have the shortcode showu p dynamically on a Divi theme product page?

    Thanks for you wisdom in advance.


    • Hemant Gaba

      Hi Steve

      The approach of using a Custom Field to provide information is correct but as you are using a tab plugin to generate a shortcode so I guess it will not take into account the information present in the Custom field and will show the general result. To achieve the results you need to write the Custom PHP code to show the tabs. In that code, you need to manipulate the value of the Custom field in such a way that it should change the content inside the tab with the change in the information of the Custom Field. After that, you need to put that code in the function to create a shortcode and then use this shortcode inside the Code Module to showcase the results on the frontend.

      Let us know if that helps.


Submit a Comment

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

Recent Posts

Welcome Hemant To Our Team

Welcome Hemant To Our Team

I would like to introduce you to our new team member, Hemant Gaba, who has been helping out with everything behind the scenes!

Pin It on Pinterest


Your Cart