Tweak templates

This commit is contained in:
Mike Jolley 2012-09-17 11:36:24 +01:00
parent 1b4130bc56
commit c271590fc9
3 changed files with 123 additions and 149 deletions

View File

@ -1106,11 +1106,11 @@ $woocommerce_settings['email'] = apply_filters('woocommerce_email_settings', arr
array(
'name' => __( 'Background colour', 'woocommerce' ),
'desc' => __( 'The background colour for WooCommerce email templates. Default <code>#eeeeee</code>.', 'woocommerce' ),
'desc' => __( 'The background colour for WooCommerce email templates. Default <code>#f5f5f5</code>.', 'woocommerce' ),
'id' => 'woocommerce_email_background_color',
'type' => 'color',
'css' => 'width:6em;',
'std' => '#eeeeee'
'std' => '#f5f5f5'
),
array(

View File

@ -4,43 +4,60 @@
*
* @author WooThemes
* @package WooCommerce/Templates/Emails
* @version 1.6.4
* @version 1.7.0
*/
// Load colours
$base = get_option( 'woocommerce_email_base_color' );
$base_lighter_40 = woocommerce_hex_lighter( $base, 40 );
// For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline.
$template_footer = "
border-top:0;
-webkit-border-radius:6px;
";
$credit = "
border:0;
color: $base_lighter_40;
font-family: Arial;
font-size:12px;
line-height:125%;
text-align:center;
";
?>
</div>
</td>
</tr>
</table>
<!-- // End Module: Standard Content \\ -->
<!-- End Content -->
</td>
</tr>
</table>
<!-- // End Template Body \\ -->
<!-- End Body -->
</td>
</tr>
<tr>
<td align="center" valign="top">
<!-- // Begin Template Footer \\ -->
<table border="0" cellpadding="10" cellspacing="0" width="600" id="templateFooter">
<!-- Footer -->
<table border="0" cellpadding="10" cellspacing="0" width="600" id="template_footer" style="<?php echo $template_footer; ?>">
<tr>
<td valign="top" class="footerContent">
<td valign="top" class="footer_content">
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
<td colspan="2" valign="middle" id="credit" style="border:0; color:<?php echo woocommerce_hex_lighter(get_option('woocommerce_email_text_color'), 40); ?>; font-family:Arial; font-size:12px; line-height:125%; text-align:center;">
<?php echo wpautop(wptexturize(apply_filters('woocommerce_email_footer_text', get_option('woocommerce_email_footer_text')))); ?>
<td colspan="2" valign="middle" id="credit" style="<?php echo $credit; ?>">
<?php echo wpautop( wptexturize( apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ) ) ); ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- // End Template Footer \\ -->
<!-- End Footer -->
</td>
</tr>
</table>
<br />
</td>
</tr>
</table>

View File

@ -4,44 +4,82 @@
*
* @author WooThemes
* @package WooCommerce/Templates/Emails
* @version 1.6.4
* @version 1.7.0
*/
// Load colours
$bg = get_option( 'woocommerce_email_background_color' );
$body = get_option( 'woocommerce_email_body_background_color' );
$base = get_option( 'woocommerce_email_base_color' );
$base_text = woocommerce_light_or_dark( $base, '#202020', '#ffffff' );
$text = get_option( 'woocommerce_email_text_color' );
$bg_darker_10 = woocommerce_hex_darker( $bg, 10 );
$base_lighter_20 = woocommerce_hex_lighter( $base, 20 );
$text_lighter_20 = woocommerce_hex_lighter( $text, 20 );
$text_lighter_40 = woocommerce_hex_lighter( $text, 40 );
$text_darker_50 = woocommerce_hex_darker( $text, 50 );
// For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline.
$wrapper = "
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAANklEQVQYV2NkIAIwEqFGkpAiSaAhzwkpAluESxHYBJhTsClCUYDPJBT/IJuEYQK6dTgVgBQCAG5EBSOuEsbJAAAAAElFTkSuQmCC);
background-repeat: repeat-y no-repeat;
background-position: top center;
background-color: $bg;
width:100% !important;
-webkit-text-size-adjust:none;
margin:0;
padding: 70px 0 70px 0;
";
$template_container = "
-webkit-box-shadow:0 0 0 3px rgba(0,0,0,0.025);
-webkit-border-radius:6px;
background-color: $body;
border: 1px solid $bg_darker_10;
-webkit-border-radius:6px;
";
$template_header = "
background-color: $base;
color: $base_text;
-webkit-border-top-left-radius:6px;
-webkit-border-top-right-radius:6px;
border-bottom: 0;
font-family:Arial;
font-weight:bold;
line-height:100%;
vertical-align:middle;
";
$body_content = "
background-color: $body;
-webkit-border-radius:6px;
";
$body_content_inner = "
color: $text_lighter_20;
font-family:Arial;
font-size:14px;
line-height:150%;
text-align:left;
";
$header_content_h1 = "
color: $base_text !important;
margin:0;
padding: 28px 24px;
text-shadow: 0 1px 0 $base_lighter_20;
";
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php echo get_bloginfo('name'); ?></title>
<style type="text/css">
/* Client-specific/Reset Styles */
#outlook a{padding:0;} /* Force Outlook to provide a "view in browser" button. */
body{
width:100% !important; /* Force Hotmail to display emails at full width */
-webkit-text-size-adjust:none; /* Prevent Webkit platforms from changing default text sizes. */
margin:0;
padding:0;
}
img{border:none; font-size:14px; font-weight:bold; height:auto; line-height:100%; outline:none; text-decoration:none; text-transform:capitalize;}
#backgroundTable{height:100% !important; margin:0; padding:0; width:100% !important;}
/* Styles for elements that are added dyanmically - we can't show them inline */
img{ border:none; font-size:14px; font-weight:bold; height:auto; line-height:100%; outline:none; text-decoration:none; text-transform:capitalize; }
mark { background: transparent none; color: inherit; }
/* Template Styles */
body {
background: <?php echo get_option('woocommerce_email_background_color'); ?> url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAOklEQVQYGWP8//8/AyHAREgBIyOjMQPIJFwYaIAxSI6RbOvAViC7A90qmBXI4qRZh2EFunXYrEC2DgDc+VH0jS2AGAAAAABJRU5ErkJggg==);
}
#templateContainer{
border: 1px solid <?php echo woocommerce_hex_darker(get_option('woocommerce_email_background_color'), 20); ?>;
-webkit-box-shadow:0 0 0 3px rgba(0,0,0,0.1);
-webkit-border-radius:6px;
}
h1, .h1,
h2, .h2,
h3, .h3,
h4, .h4 {
color:<?php echo woocommerce_hex_darker(get_option('woocommerce_email_text_color'), 50); ?>;
h3, .h3 {
color: <?php echo $text_darker_50; ?>;
display:block;
font-family:Arial;
font-size:34px;
@ -54,145 +92,64 @@
text-align:left;
line-height: 1.5;
}
h2, .h2{
font-size:30px;
}
h3, .h3{
font-size:26px;
}
h4, .h4{
font-size:22px;
}
/* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: HEADER /\/\/\/\/\/\/\/\/\/\ */
#templateHeader{
background-color: <?php echo get_option('woocommerce_email_base_color'); ?>;
background: -webkit-linear-gradient(<?php echo woocommerce_hex_lighter(get_option('woocommerce_email_base_color'), 20); ?>, <?php echo get_option('woocommerce_email_base_color'); ?>);
border-bottom:0;
-webkit-border-top-left-radius:6px;
-webkit-border-top-right-radius:6px;
}
.headerContent{
padding:24px;
vertical-align:middle;
}
.headerContent a:link, .headerContent a:visited{
color:<?php echo woocommerce_light_or_dark(get_option('woocommerce_email_base_color'), '#202020', '#ffffff'); ?>;
h2, .h2{ font-size:30px; }
h3, .h3{ font-size:26px; }
.header_content a:link, .header_content a:visited {
color:<?php echo $base_text; ?>;
font-weight:normal;
text-decoration:underline;
}
/* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: MAIN BODY /\/\/\/\/\/\/\/\/\/\ */
#templateContainer, .bodyContent{
background-color:<?php echo get_option('woocommerce_email_body_background_color'); ?>;
-webkit-border-radius:6px;
}
.bodyContent div{
color: <?php echo woocommerce_hex_lighter(get_option('woocommerce_email_text_color'), 20); ?>;
font-family:Arial;
font-size:14px;
line-height:150%;
text-align:left;
}
.bodyContent div a:link, .bodyContent div a:visited{
color: <?php echo get_option('woocommerce_email_text_color'); ?>;
.body_content div a:link, .body_content div a:visited {
color: <?php echo $text; ?>;
font-weight:normal;
text-decoration:underline;
}
.bodyContent img{
.body_content img{
display:inline;
height:auto;
}
/* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: FOOTER /\/\/\/\/\/\/\/\/\/\ */
#templateFooter{
border-top:0;
-webkit-border-radius:6px;
}
.footerContent div{
color:<?php echo woocommerce_hex_lighter(get_option('woocommerce_email_text_color'), 40); ?>;
font-family:Arial;
font-size:12px;
line-height:125%;
text-align:left;
}
.footerContent div a:link, .footerContent div a:visited{
color:<?php echo woocommerce_hex_lighter(get_option('woocommerce_email_text_color'), 40); ?>;
.footer_content div a:link, .footer_content div a:visited {
color:<?php echo $text_lighter_40; ?>;
font-weight:normal;
text-decoration:underline;
}
.footerContent img{
display:inline;
}
#credit {
border:0;
color:<?php echo woocommerce_hex_lighter(get_option('woocommerce_email_text_color'), 40); ?>;
font-family:Arial;
font-size:12px;
line-height:125%;
text-align:center;
}
</style>
</head>
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="background: <?php echo get_option('woocommerce_email_background_color'); ?> url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAOklEQVQYGWP8//8/AyHAREgBIyOjMQPIJFwYaIAxSI6RbOvAViC7A90qmBXI4qRZh2EFunXYrEC2DgDc+VH0jS2AGAAAAABJRU5ErkJggg==);">
<center style="padding: 70px 0 0 0;">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="backgroundTable">
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
<center style="<?php echo $wrapper; ?>">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tr>
<td align="center" valign="top">
<?php
if ($img = get_option('woocommerce_email_header_image')) :
echo '<p style="margin-top:0;"><img src="'.$img.'" alt="'.get_bloginfo('name').'" /></p>';
endif;
if ( $img = get_option( 'woocommerce_email_header_image' ) ) {
echo '<p style="margin-top:0;"><img src="' . $img . '" alt="' . get_bloginfo( 'name' ) . '" /></p>';
}
?>
<!-- // End Template Preheader \\ -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateContainer" style="-webkit-box-shadow:0 0 0 3px rgba(0,0,0,0.025); -webkit-border-radius:6px;background-color:<?php echo get_option('woocommerce_email_body_background_color'); ?>;">
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container" style="<?php echo $template_container; ?>">
<tr>
<td align="center" valign="top">
<!-- // Begin Template Header \\ -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateHeader" style="background-color:<?php echo get_option('woocommerce_email_base_color'); ?>; -webkit-border-top-left-radius:6px; -webkit-border-top-right-radius:6px; color:<?php echo woocommerce_light_or_dark(get_option('woocommerce_email_base_color'), '#202020', '#ffffff'); ?>; font-family:Arial; font-weight:bold; line-height:100%; vertical-align:middle;">
<!-- Header -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_header" style="<?php echo $template_header; ?>" bgcolor="<?php echo $base; ?>">
<tr>
<td class="headerContent" style="padding:24px; ">
<!-- // Begin Module: Standard Header Image \\ -->
<h1 class="h1" style="color:<?php echo woocommerce_light_or_dark(get_option('woocommerce_email_base_color'), '#202020', '#ffffff'); ?> !important; margin:0; text-shadow:0 1px 0 <?php echo woocommerce_hex_lighter(get_option('woocommerce_email_base_color'), 20); ?>;"><?php
echo $email_heading;
?></h1>
<!-- // End Module: Standard Header Image \\ -->
<td class="header_content">
<h1 class="h1" style="<?php echo $header_content_h1; ?>"><?php echo $email_heading; ?></h1>
</td>
</tr>
</table>
<!-- // End Template Header \\ -->
<!-- End Header -->
</td>
</tr>
<tr>
<td align="center" valign="top">
<!-- // Begin Template Body \\ -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateBody">
<!-- Body -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_body">
<tr>
<td valign="top" class="bodyContent" style="background-color:<?php echo get_option('woocommerce_email_body_background_color'); ?>;">
<!-- // Begin Module: Standard Content \\ -->
<td valign="top" class="body_content" style="<?php echo $body_content; ?>">
<!-- Content -->
<table border="0" cellpadding="20" cellspacing="0" width="100%">
<tr>
<td valign="top">
<div>
<div style="<?php echo $body_content_inner; ?>">