Recently I was asked how to add a newsletter subscription box to a WordPress theme. Because this is a question I’ve been asked more than once, I’ve decided to do a short tutorial. There are only a few things you’ll need to get started.
- Text or HTML editor
- Your subscription box code which can usually be copied from your newsletter service provider
- The theme’s sidebar.php file, assuming that is where you’d like to add the subscription box
- FTP client to upload the file to your theme folder once finished. (You can edit it from the WordPress admin panel, however, I don’t always recommend that route.)
For this example, we’ll go over adding the code to the top of the sidebar. Before we begin, make a back up copy of your sidebar.php file.
- Open the sidebar.php file in a text or HTML editor.
- Just under the opening unordered list tag (<ul>), add a new list item (<li></li>) and between it, type the title of your subscription box.
- Below your section title, copy and paste your subscription box code. (If the code you’re provided with isn’t compliant, you may need to edit it; otherwise it may throw off your design. )
- Save the file and upload it to your theme folder, making sure to overwrite the previous sidebar.php file.
- Go to your blog, refresh, and feel good about your work.
There you have it. Your blog should now have a newsletter subscription box in place if all went well.
Note: If you’re using the widgets plugin, adding code to your sidebar is slightly different. You will need to create a new text box from your admin panel and copy the newsletter code into it.
[tags]wordpress tutorial, add newsletter subscription box[/tags]