Skip to content

Instantly share code, notes, and snippets.

@joshmoto joshmoto/index.php Secret
Created Nov 15, 2012

What would you like to do?
Wordpress Mailer Template
define('WP_USE_THEMES', false);
// require 'config.php';
$imageUrl = '';
$getLatest = get_terms('mailers','orderby=id&order=DESC&number=1');
$mailer = $getLatest[0]->slug;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<title><?php $term = get_term_by( 'slug', $mailer, 'mailers'); echo $term->name; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
/* Client-specific Styles */
/* Force Outlook to provide a "view in browser" button. */
#outlook a{padding:0;}
/* Force Hotmail to display emails at full width */
body{width:100% !important;} .ReadMsgBody{width:100%;} .ExternalClass{width:100%;}
/* Prevent Webkit and Windows Mobile platforms from changing default font sizes. */
body{-webkit-text-size-adjust:none; -ms-text-size-adjust:none;}
/** 3. Yahoo paragraph fix: removes the proper spacing or the paragraph (p) tag. To correct we set the top/bottom margin to 1em in the head of the document. Simple fix with little effect on other styling. You do not need to move this inline. NOTE: It is also common to use two breaks instead of the paragraph tag but I think this way is cleaner and more semantic. NOTE: This example recommends 1em or 1.12 em. More info on setting web defaults: or
p {
margin: 1em 0;
/** 4. Hotmail header color reset: Hotmail replaces your header color styles with a green color on H2, H3, H4, H5, and H6 tags. In this example, the color is reset to black for a non-linked header, blue for a linked header, red for an active header (limited support), and purple for a visited header (limited support). Replace with your choice of color. The !important is really what is overriding Hotmail's styling. Hotmail also sets the H1 and H2 tags to the same size.
h1, h2, h3, h4, h5, h6 {
color: #1b3d52 !important;
line-height: 100% !important;
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
color: #1b3d52 !important;
h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {
color: #1b3d52 !important; /* Preferably not the same color as the normal header link color. There is limited support for psuedo classes in email clients, this was added just for good measure. */
h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {
color: #1b3d52 !important; /* Preferably not the same color as the normal header link color. There is limited support for psuedo classes in email clients, this was added just for good measure. */
/** Outlook 07, 10 Padding issue: These "newer" versions of Outlook add some padding around table cells potentially throwing off your perfectly pixeled table. The issue can cause added space and also throw off borders completely. Use this fix in your header or inline to safely fix your table woes.
More info:
H/T @edmelly
table td {
/** BONUS: Adaptation of Brian Thies (Campaign Monitor) link color fix to render the Yahoo Short Cuts invisible. Yahoo short cuts are links that Yahoo places over certain text in your email without your knowledge. In order to use this fix you need to make the text color the same of the actual font color of your email and reset a few elements. IMPORTANT: You then need to use the Responsys/Smith Harmon link color fix (#7) if you want to style your links to the color you want them to be. If you don't, this fix will change all links to black in Yahoo.
If you are not worried about Yahoo's shorcuts, just remove this code. This is not applicable for Yahoo Classic.
.yshortcuts, .yshortcuts a, .yshortcuts a:link,.yshortcuts a:visited, .yshortcuts a:hover, .yshortcuts a span { color: #1b3d52; text-decoration: none !important; border-bottom: none !important; background: none !important;} /* Body text color for the New Yahoo. This example sets the font of Yahoo's Shortcuts to black. */
<body style="width: 100%; background-color:#f5f5f5; padding:0 !important; margin:0 !important; color:#1b3d52;">
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100%; background-color:#f5f5f5; padding:0 !important; margin:0 !important; font-family: Arial, Helvetica, sans-serif; -webkit-text-size-adjust:none; font-size:10px; color: #1b3d52;">
<td bgcolor="#f5f5f5">
<table width="650" border="0" align="center" cellpadding="0" cellspacing="0">
<?php the_content(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.