How to Add a Download Image Button in Divi

Want to add a one-click image download button in Divi without installing any plugins? Normally, enabling direct downloads requires complex coding, but we’ve got a simple solution for you!

In this step-by-step guide, you’ll learn how to turn Divi’s Button Module into a direct download button using a small snippet of jQuery—no need to edit PHP files or modify .htaccess. Just copy and paste the provided code, and your download button will be ready in minutes!

Follow along, and by the end of this tutorial, you’ll have a fully functional image download button that works seamlessly with Divi Theme. Let’s get started!

Step 1: Accessing the Page for Global Module

To add a direct download button, we need to navigate to the page where we want to add the download button.

  1. Click on Pages.
  2. Click on All Pages.
  3. Select the page (as we selected our homepage) and click on the Edit button, as shown in the screenshot below.
  4. Click on the Edit with The Divi Builder button.
Navigate to the desired page in WordPress, select it from All Pages, and open it in Divi Builder to add a direct download button.

Step 2: Insert a Button Module for the Download Button

Once the page opens in the Divi Visual Builder (as shown in the screenshot), select the section where you want to add the direct download button. Then, insert the Button Module, which we will change into an image download button.

  1. Click on the Plus (+) Icon.
  2. The Insert Module window will appear.
  3. Search for Button in the search bar.
  4. Click on the Button Module to insert it.
Add a Button Module in Divi Visual Builder by clicking the Plus icon, searching for "Button," and inserting it into the desired section.

Step 3: Configure the Button Module for Image Download

Once you insert the Button Module, its settings will automatically open. Now, follow these steps to customize it:

  1. Go to the Content tab. Click on the Text option.
  2. Enter the button name, like “Download Now”.
  3. Click on the Link option.
  4. Paste the URL of the image you want to offer for download into the Button Link URL box.
  5. Set the Button Link Target to Open in a New Tab.
Customize the Divi Button Module by setting the button text, adding the image URL in the Button Link field, and enabling "Open in a New Tab" under the Link settings.

Step 4: How to Find an Image URL in WordPress

If you don’t know how to find an image URL, come  to your WordPress Dashboard and follow these steps. If you already have the URL, you can skip this part.

  1. Open your WordPress dashboard in a new tab and click on Media.
  2. Click on Library to view all uploaded files.
  3. Select the image you need and open its settings.
  4. Copy the URL from the provided field (as shown in the screenshot).
Copying an image URL from the WordPress Media Library by selecting an image and viewing its settings in the dashboard.

Step 5: Add a Custom CSS Class to the Button

Now, we’ll continue configuring the button by adding a custom CSS class in the Advanced tab. Follow these steps:

  1. Click on the Advanced tab.
  2. Select the CSS ID & Classes option.
  3. Copy the CSS class “divi-cake-download” and paste it into the CSS Class box.
  4. Click on the Tick Mark (✔) to save the button settings.
  5. Save the entire page by clicking the Save button, as shown in the screenshots.
Adding the custom CSS class "divi-cake-download" to a button in Divi by navigating to the Advanced tab and updating the CSS Class settings.

Step 6: Customize the Button’s Design (Optional)

If you want to customize the button—like changing its color, size, or style—you can do so without any issues. Since this is Divi’s own Button Module, you have full control over its design. Feel free to adjust it according to your website’s design preferences.

Learn More: Add Divi Button Modules Side by Side

Step 7: Add JavaScript Code to Enable File Download

After making all the changes, return to the WordPress dashboard to add a small JavaScript snippet that enables the download functionality.

Copy the following JavaScript code

<script>
jQuery(document).ready(function(){
  var downloadButton = jQuery('.divi-cake-download');
    
  downloadButton.each(function(index) {
    jQuery(this).attr('download', '');
  });
});
</script>
  1. In the WordPress dashboard, click on Divi.
  2. Select Theme Options.
  3. In Divi Theme Options, go to the Integration tab.
  4. Scroll down and Paste the copied JavaScript code into the Add code to the <head> of your blog section.
  5. Click the Save button, as shown in the screenshot.
Inserting JavaScript code in the Divi Theme Options Integration tab to enable file download functionality for a custom button.

Final Result

The GIF below demonstrates the successful implementation of a direct download button in the Divi Theme using code—without the need for any plugins.

Inserting JavaScript code in the Divi Theme Options Integration tab to enable file download functionality for a custom button.

Conclusion

And that’s it! You’ve successfully added a direct image download button in Divi—without using any extra plugins or complicated coding. By following this guide, you’ve learned how to insert a button module, customize its settings, and add a simple JavaScript snippet to enable the download functionality.

Now, your visitors can download images instantly with just one click, improving their user experience and making your site even more interactive. Want to customize the button further? Feel free to tweak the design to match your website’s style!

If you found this tutorial helpful, stay tuned for more Divi tips and tricks.

Learn More: Creating Effective Call-To-Actions Buttons with Divi

0 Comments

Submit a Comment

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

Pin It on Pinterest

Shares