WooThemes’ Subscribe and Connect is a great feature but it only works with MailChimp at the moment and many of us want to use AWeber to handle our email marketing. So today I’m going to show you how to integrate WooThemes’ Subscribe and Connect with AWeber using a child theme.
To follow this guide, you’ll need access to your website files via your hosting file manager or FTP client (I use FileZilla). I’d also recommend downloading Notepad++ if you don’t already have it – makes it much easier to edit source code. Both these are open source so you can download them for free.
I’ll be using WooThemes’ Canvas as my theme in this example. Other themes may have different file names but you can search for the code using Notepad’s “find in files” function.
How to create a child theme in WordPress
Create a folder in wp-content/themes with the name of your child theme (no spaces).
Open the folder and create a file called style.css.
Open the file and place this code at the top:
Theme Name: My Child Theme
Save and close the file, then go to Appearance > Themes and change the theme to your child theme.
That’s it, you’re done!
How to integrate your AWeber form into the Subscribe and Connect function
Create a new file in your child theme folder called functions.php – this file contains the functions you want to add to your child theme or in this case, override in your parent theme.
All the latest WooThemes’ themes have built in support for overriding functions via a child theme. If yours doesn’t, you can still use this guide, you’ll just need to do a few more steps (I’ll link to this in a future post).
Here’s my 10 step guide to integrating WooThemes’ Subscribe and Connect with AWeber using a child theme:
First create a new file called aweber-form.php in your child theme folder. Then go to AWeber, copy the basic HTML code for your sign up form (without the beautiful form styles) and paste it into the file. Then, if you ever need to update your form, you can just copy and paste the new code into this file.
Next, find the location of the subscribe and connect function by searching through the parent theme’s files. In the latest release of Canvas (5.6.2), it’s located in theme-functions.php, which is in the includes subfolder.
Copy the subscribe and connect function and paste it into your new functions.php file, making sure to include the PHP opening/closing tags.
Then insert lines 78-84 as shown below (big block of code coming!)
The code checks that the Feedburner and MailChimp URL fields are empty before executing the function so provided you haven’t entered anything into these, when you activate subscribe and connect in the theme options or insert the widget, your AWeber sign up form will be displayed where the MailChimp form would normally be.
And if I don’t want to use a child theme?
If you don’t want to use a child theme, you can make the same changes to the original function and make a note to apply the changes again when you update your theme.