In This Article
2. Before you start: get your file ready
3. Part 1: The download button after signup
3.1. How it works
3.2. Step 1: Build the column
3.3. Step 2: Add the classes
3.4. Step 3: Clear Divi’s own success message
3.5. Step 4: Add the button and the script
3.6. Step 5: Add the CSS
3.7. Prefer a Button module? (Divi 5)
3.8. Step 6: Test it
4. Part 2: The same file in your emails
4.1. You often can’t upload the file to your email tool
4.2. The download attribute doesn’t work in emails
4.3. When a ZIP doesn’t download
5. Advanced: make files download everywhere with .htaccess
6. What about Google Drive or Dropbox?
7. Common mistakes
8. The takeaway
In Divi, this is where things get a little awkward. The Email Optin module can show a message or send people to another page, but it can’t hand them the file. So they’re told to check their inbox, and they go off to wait for an email.
And when the email arrives, the link doesn’t always work the way you’d expect. A PDF opens in a browser tab instead of downloading. Some files open as a page full of code. And your email tool might not let you upload the file at all.
We ran into all of this setting up our own funnels. Here’s how we solved it: a download button that appears right on the page the moment someone signs up, and a file link that works from your emails too.
What we’re building
1. On the page. When someone submits the form, the form disappears and a short thank-you message appears in its place, with a download button. Same page, no redirect, no waiting.
2. In the email. The first email of your welcome sequence links to the same file, as a backup for anyone who closes the tab before downloading.
We use both on our own opt-in pages. The button gets the freebie into people’s hands straight away, and the email gives them a way back to it later. (If you haven’t built the page yet, start with how to build an opt-in page in Divi.)
Before you start: get your file ready
Keep the file on your own site. The download button relies on a small piece of HTML that browsers only respect for files on the same site. A file on Google Drive or another domain will open instead of downloading.
A quick word on file types, because it matters later:
- PDFs download from the button. From an email, most browsers open them in a tab, where people can still save them.
- ZIP files download straight away, from the button and from emails, on most hosts.
- Other files, like JSON layout files, often open in the browser as a page of code. The simplest fix is to put them in a ZIP. If you have several files, a ZIP is tidier anyway.
Part 1: The download button after signup
How it works
- The column gets the class subscription-column.
- The Email Optin module gets the class subscription-form. This is what people see before they sign up.
- The success content (a thank-you text, the download button, a small line underneath) gets the class subscription-success. This is hidden until they sign up.
Step 1: Build the column
1. The Email Optin module, connected to your email provider and list.
2. A Text module with your thank-you message, for example “Your checklist is ready to download.”
3. A Code module for the download button (we’ll fill it in Step 3).
4. Optionally, another Text module for a small line under the button, like “We’ve also sent the link to your email, so you can come back to it anytime.”
Step 2: Add the classes
- Column: subscription-column.
- Email Optin module: subscription-form
- Thank-you text, Code module and the small text line: subscription-success
In Divi 5, open Advanced → Attributes and click Add Attribute. Set the Attribute Name to class and the Attribute Value to the class name, for example subscription-column.
Step 3: Clear Divi’s own success message
In the Email Optin settings, open Success Action. Set the Action to Display a message, and type a single space in the Message field. That way Divi shows nothing, and your own success content takes over.
Step 4: Add the button and the script
<a href="https://yoursite.com/wp-content/uploads/2026/11/your-freebie.pdf" download="your-freebie.pdf">Download your checklist</a>
<script>
// When the Email Optin form is submitted successfully,
// change the column's class so the CSS shows the success content.
jQuery(document).ajaxSuccess(function (event, xhr, settings, data) {
if (data && data.success) {
if (settings?.data && typeof settings.data === 'string' && settings.data.includes('action=et_pb_submit_subscribe_form')) {
const column = document.querySelector('.et_pb_column.subscription-column');
if (column) {
column.classList.replace('subscription-column', 'subscription-column-success');
}
}
}
});
</script>
- href: your file’s URL from the Media Library.
- download: the name the file should have when it lands on someone’s computer. This is also the part that tells the browser to download the file instead of opening it.
What the script does, in plain words: Divi sends the signup to your email provider in the background. The script listens for that, and when Divi reports that a signup went through, it finds the column and swaps its class. If the signup fails (a mistyped email, for example), nothing changes, and the form stays where it is.
Step 5: Add the CSS
/* The download button */
selector a {
display: inline-block;
width: 100%;
padding: 12px 40px;
border-radius: 4px;
background-color: #00aeb9;
color: #fff;
font-weight: 700;
letter-spacing: 1px;
text-align: center;
}
/* After signup: hide the form */
body:not(.et-vb-app-ancestor) .subscription-column-success .subscription-form {
display: none;
}
/* Before signup: hide the success content */
body:not(.et-vb-app-ancestor) .subscription-column .subscription-success {
display: none;
}
Change the button colours, padding and corners to match your brand. Because the button lives in a Code module, this CSS is where its look is set, not a design tab.
By the way, the body:not(…) part is a small trick. It switches the hiding off inside the Divi Builder, so while you’re editing, you see the form and the success content at the same time and can work on both. On the live page, only one shows at a time.
Step 6: Test it
- the form disappears and the thank-you message and button appear
- the button downloads the file instead of opening it
- you’ve been added to the right list
A few things to know:
- One form per page. The script looks for the first column with the subscription-column class. If you have two of these forms on one page, only the first will swap.
- Performance plugins. If you use a plugin that delays or combines JavaScript and the swap doesn’t happen, try excluding this script from it.
Part 2: The same file in your emails
You often can’t upload the file to your email tool
The easiest place is your own site. Use the same Media Library link you used for the button. One file, one link, nothing to keep in sync.
The download attribute doesn’t work in emails
- A PDF opens in a browser tab. That’s fine for most people, since they can read it or save it from there.
- A ZIP downloads, because browsers can’t show it.
- A JSON file (or another text-based file) opens as a page of code. Put it in a ZIP, and the problem goes away.
When a ZIP doesn’t download
- The server sends the wrong file type, so the browser tries to show the file instead of downloading it, and you see garbled text.
- Security rules or hotlink protection block links from outside your site, or show an error instead of the file.
- A plugin (membership, download protection or security) puts the file behind a login or a redirect.
- A CDN or cache in front of your site changes how the file is sent.
Advanced: make files download everywhere with .htaccess
A word of caution: .htaccess controls how your site is served, and a small mistake can take your site offline. Make a backup of the file first.
The tidiest way is to keep your freebies in their own folder, for example /downloads/, and put a .htaccess file inside that folder with this:
<IfModule mod_headers.c>
<FilesMatch "\.(?i:pdf|zip|json|docx)$">
ForceType application/octet-stream
Header set Content-Disposition "attachment"
</FilesMatch>
</IfModule>
Two things to check: this only works on servers that read .htaccess files (Apache and LiteSpeed). If your host uses Nginx, ask them to set it up for you. And if you’d rather not touch server files at all, a download manager plugin can force downloads through its own links, though it’s more than you need for one freebie.
What about Google Drive or Dropbox?
Common mistakes
- Forgetting to change the sample link. Test the button before sharing the page, not after.
- Linking to a file on another site. The download attribute only works for files on your own site.
- Sending a JSON file by email as it is. It opens as code. Zip it first.
- Leaving Divi’s success message on. Then people see two messages at once.
- Only testing while logged in. Use a private window, so you see exactly what visitors see.
The takeaway
For the email, keep the file on your own site and use the same link. If it isn’t a PDF, zip it, and it will download wherever people click it.

