OptinMonster allows you to easily use shortcodes from your WordPress plugins or theme. Follow our documentation to learn how to use WordPress shortcodes with OptinMonster.
- Add Your Shortcode
- Refresh Campaigns in the OptinMonster API Plugin
- Go Live
- View & Test Your Campaign
- Make Style Adjustments (optional)
Step 1 – Add Your Shortcode
In this demo we’ll add a WPForms shortcode, so we can copy the shortcode for our form after selecting the Embed button in the plugin’s form builder.
Once you’ve copied the shortcode go to your campaign and add an HTML element to your campaign.
Add the shortcode in the HTML box.
Save the changes to your campaign before proceeding.
Step 2 – Refresh Campaigns in the OptinMonster API Plugin
Before the campaign can display the shortcode it contains, the campaigns list in the OptinMonster API plugin needs to be refreshed.
Navigate to the WordPress Admin > OptinMonster > Optins tab view and select the Refresh Campaigns button.
Step 3 – Go Live
Next, in the OptinMonster plugin, select the Go Live link for your campaign to output the embed code across your site.
Step 4 – View & Test Your Campaign
Go ahead and load the front-end of your site where you’ve specified the campaign should load to ensure the shortcode is being correctly parsed.
Step 5 – Make Style Adjustments (optional)
You may wish to add CSS to control the appearance of the campaign’s contents.
You can easily add CSS to your campaign in the Display Settings panel’s Custom CSS field. See our custom CSS guide for more information.
Save any changes before returning to the front-end of your site to view the updated campaign.
Want to track conversion stats for your custom form? See our guide on how to track conversions when using a custom form!
Q: What if I’m manually adding the embed code to my site? What if I’m using Google Tag Manager to display my campaigns on my site?
A: If you’re manually adding the embed code or using Google Tag Manager instead of the OptinMonster API plugin for WordPress the shortcodes will not be parsed in your campaigns. If you want to use shortcodes in your campaigns you’ll need to use the OptinMonster API plugin to control where the campaigns appear on your site instead.
Q: Do I need to use both the WordPress Plugin and the Display Rules?
A: Learn how our WordPress Plugin and Display Rules work together.