secret
Last active

Wordpress Mailer Template

  • Download Gist
index.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
<?php
 
define('WP_USE_THEMES', false);
 
// require 'config.php';
require('/home/sites/example_co_uk/www/wp/wp-load.php');
 
$imageUrl = 'http://mailers.example.co.uk/';
 
$getLatest = get_terms('mailers','orderby=id&order=DESC&number=1');
$mailer = $getLatest[0]->slug;
 
remove_all_filters('the_excerpt');
 
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<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: http://www.w3.org/TR/CSS21/sample.html or http://meiert.com/en/blog/20070922/user-agent-style-sheets/
INLINE: Yes.
**/
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.
INLINE: Yes.
**/
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: http://www.ianhoar.com/2008/04/29/outlook-2007-borders-and-1px-padding-on-table-cells/
http://www.campaignmonitor.com/blog/post/3392/1px-borders-padding-on-table-cells-in-outlook-07/
H/T @edmelly
INLINE: No
**/
table td {
border-collapse:collapse;
}
/** 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.
INLINE: No.
**/
.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. */
</style>
</head>
<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;">
<tr>
<td bgcolor="#f5f5f5">
<table width="650" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php the_content(); ?>
 
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.