Automating HTML email with WordPress
Video: Automating HTML email with WordPressHaving discussed concepts, let's look at using WordPress to automate the creation of emails. To automate email newsletters with WordPress, we will follow these steps. We will create a category called Newsletter, and we will get the ID. We will create posts, tag each post with the Newsletter category, and add custom fields, two of them: one called explore link icon and the other, image thumbnail. Third, we will create a template with the name Email Newsletter. We will use query_post to display their most recent entries tagged with category Newsletter.
- Next steps
Viewers: in countries Watching now:
This course provides hands-on training on all aspects of email marketing, from crafting emails and setting up effective marketing campaigns to managing spam filters and evaluating delivery services. Author Tim Slavin introduces the fundamentals of email marketing, including the differences between HTML email and web pages, how to code emails that display properly on receipt, and ways to stay current with HTML email standards and capabilities. The course includes several project-oriented tutorials on creating multi-column newsletter layouts and multi-product offer emails, and also explains how to automate email creation, test emails prior to delivery, outsource campaigns, and address common coding problems.
- Understanding MIME types
- Reducing spam potential in an email or email list
- Creating content for email campaigns
- Understanding the design constraints of HTML emails
- Building email address lists
- Understanding the ideal coding process
- Designing a plain text email from an HTML email
- Deciding how and when to test an email
- Sending email with canned templates
- Troubleshooting layout, spacing, and image issues
- Adding video to email
Automating HTML email with WordPress
Having discussed concepts, let's look at using WordPress to automate the creation of emails. To automate email newsletters with WordPress, we will follow these steps. We will create a category called Newsletter, and we will get the ID. We will create posts, tag each post with the Newsletter category, and add custom fields, two of them: one called explore link icon and the other, image thumbnail. Third, we will create a template with the name Email Newsletter. We will use query_post to display their most recent entries tagged with category Newsletter.
And finally, we will create a page, we will assign the template Email Newsletter to that page, and we will publish. Let's look at each of these steps now. The first step is to create a category called Email or Email Newsletter. In this case we've used the phrase Email Newsletter. If we click the Email Newsletter link, we see the Edit Category page, and up in the URL there is a value call tag_ID =3. This is WordPress's unique ID for this category. We will need this later when we code or template. For now, let's remember the ID for this category is 3.
The second step will be to create a post. We have a post here, Cycle California Tours, and if you recall, this is the two- column email that we will automate, and we had, for each tour, a logo, a description, and a link to explore more information about that tour. Now, we will replicate that a little bit. We will create a post for the Cycle Tour. Once we have our copy in the Edit box, then we go over to Categories, we select the Email Newsletter, we scroll down, and we create two custom fields. One is called to EXPLORE Link Icon, and that refers to the EXPLORE Link with the little start.
The stars are either blue or red or gray. In this case, our Custom Field, explore link icon, we'll choose red. The second Custom Field we add is Image Thumbnail. This corresponds to the Cycle Tours logo here. To get the value for the image thumbnail, we upload the image using WordPress's Add an Image pop-up. Since we've already added it, it's in our gallery. There is the logo. We scroll down.
We look for the link URL. We highlight it, Copy, close Add an Image pop-up, scroll down, and now we have a value for our image thumbnail Custom Field, and we click Update. So now we have a post that is one tour description with its logo image and a choice of explore button. We've also tagged it with the Email Newsletter category, and we've added to custom fields, one to define the explore button we want and the other to define the thumbnail logo that we want to use.
The next step is to work on the template. If you recall, our category ID was the number 3. So when we scroll down, in PHP we are using the query_posts function. We use showposts. We want four posts. If you recall our original email, we had one, two, three, and four tours, so we have four posts. Our category ID is the number 3, which we retrieved earlier. The next thing in our code does is retrieve the custom field for image thumbnail.
We've typed in here the custom field name as it appeared on the post form we saw moment ago. We retrieved the explorer icon, which works exactly the same way as the image thumbnail. You type in the custom field name as it appears on the post form. Then we retrieve the excerpt, and because the excerpt comes packaged with a paragraph tag, HTML p tag, before and after the excerpt, we need to remove that, because in our HTML email, it will mess up our formatting. Once we have our image thumbnail, then we build the actual image code for our logos.
Then we use a custom field to define the explore button to define which image to call. In this case, it's red, so we know that the explore red button will appear. Finally, we have one instance of our table that contains tour logo, the tour description, and the explore link. And within this one instance, we have PHP code to display the thumbnail at the right spot, display the tour description as an excerpt at the right spot, and then the permaLink at the right spot.
Finally, with our template, so that we can find it with the page, at the very top of the template we define the template name as Email Newsletter. The last step is to create a page. We have a page called Newsletter. When we open it, we have selected a template over here on the right called Email Newsletter, and when we update it, you see that we have automated the two-column HTML email with WordPress using the first post. If you want to see a little bit about how this works, we will go back to our post.
We will use the blue explorer icon. We will update it, update our post. Now we have the red explorer icon. Now we have the blue. This video only shows a general way to automate the creation of emails with WordPress. You will to need to refer to other online documentation for the software if you want or need more technical details.
There are currently no FAQs about Effective HTML Email and Newsletters.