Using HubSpot CTAs in Wordpress can be less than seamless. HubSpot provides an embed code to be used on external sites, but a user has to copy the CTA code and paste it in whenever they would like that CTA to display. So, we decided to build a custom plugin that made this integration a little smoother.
At Captevrix, we have several WordPress hosted sites that use some of the features of HubSpot, like CTAs, emails, landing pages, and tracking. Our non-developer team members don’t want to deal with embed codes, understandably. Publishing new posts and pages with CTAs is a hassle when needing to pull in a developer (like me) to add in the embed code.
Enter: HubSpot CTAs in WordPress
To solve this problem, I created a plugin that requires entering the embed code only once in the admin area. Then, any added CTAs can be inserted via a visual interface within the native post or page’s editor. Feel free to download the plugin at the bottom of the post and try it out on your site.
After installing and activating the plugin, the admin options page can be found under Settings > HubSpot CTAs. Here, you can add, edit, or delete CTAs for your site. Simply give the CTA a name, paste in the embed code, and copy over the CTA image URL from HubSpot’s File Manager.
How to Use
1. “Add CTA” Button
On every post and page now, you’ll see an “Add CTA” button in your tinyMCE editor’s toolbar. Click it to select a CTA to insert. Click Select, and a shortcode will automatically be inserted into the post at your pointer’s current location.
2. The Shortcode
You can also handwrite a shortcode using the following format
Replace the ID value (0 at the moment) with the ID of the CTA you want to insert. You can find the ID in the admin options page. In a PHP file, you can use this shortcode using WordPress’ do_shortcode() function.
Want to try it out?
Below is the ZIP file for the plugin. Feel free to download it and use it on your site. However, we will not support it, and are not liable for any effects it may have on your site. As always, with wordpress, we recommend backing up prior to installing any plugins.
If you found this plugin helpful, please comment on this post and let us know!