Learn how to add a pop-up to your Flatsome theme that appears automatically or with a button click! This guide walks you through setting it up with simple code adjustments, perfect for engaging visitors on your e-commerce site.
Tutorial Steps
-
Setting Up the Automatic Pop-Up
- Go to your desired webpage and add the Lightbox shortcode to trigger a pop-up.
[lightbox id="test" width="500px" padding="0px" auto_open="true" auto_timer="3000" auto_show="once"]Add lightbox content here..[/lightbox]
-
- Adjust settings like
auto_open
andauto_timer
. Settingauto_open
totrue
will trigger the pop-up automatically, and settingauto_timer
to3000
milliseconds will make it appear after 3 seconds. - To ensure the pop-up only appears once, set
auto_show
toonce
. If you need it to reappear, clear your browser cache or cookies.
- Adjust settings like
-
Adding Pop-Up Trigger on Specific Pages
- Log into your WordPress dashboard, navigate to the page where you want the pop-up (e.g., the Contact page).
- Open UX Builder on that page, add a text element, and paste the Lightbox shortcode.
- Set the
id
of your pop-up (e.g., “contact-popup”) to help differentiate it from others. Save your changes.
-
Creating a Button to Open the Pop-Up
- Return to the page in UX Builder where you want to add a clickable button.
- Insert a new button and add a link that references your pop-up
id
. For example, if yourid
is “contact-popup,” add#contact-popup
as the link. - Save the page, and your button will now trigger the pop-up when clicked.
-
Adding the Pop-Up Sitewide
- To display the pop-up on every page, go to Flatsome Advanced Settings.
- Paste your Lightbox shortcode into the footer script area. This will trigger the pop-up on all pages where the script is active.
- Remember, if it doesn’t appear right away, clear your cache and try refreshing the page.
-
Customizing the Pop-Up Design
- In the WordPress dashboard, create a new UX Block and design the content layout for your pop-up.
- Copy the shortcode of your new UX Block and add it to your Lightbox shortcode, updating the pop-up content dynamically.
- Adjust the width, padding, or any other style properties to refine the look.
-
Final Preview and Publishing
- Clear your cache one last time and preview your site to confirm the pop-up triggers as expected.
- Make any final tweaks to the design or behavior as needed.
By following these steps, you’ve now added a flexible pop-up feature to your Flatsome theme! Whether set to trigger automatically after a few seconds or by clicking a button, your pop-up can enhance visitor engagement—perfect for growing your audience, promoting deals, or gathering leads.
With the customization options in Flatsome, you’re fully equipped to tailor the look and feel of your pop-up to fit seamlessly with your site. Keep experimenting with different placements and designs to find what works best for your visitors. Happy building, and thanks for following along—see you in the next tutorial!
Continue learning
Need a custom design? Hire Seb today
Get the #1 All In One Design Agency for Flatsome