Created
March 18, 2015 20:09
-
-
Save Willem-Siebe/1f83a5b53bb8f7ea89bc to your computer and use it in GitHub Desktop.
Inline styling for own email templates WooCommerce before version 2.3.x, after version 2.3.x just use the new email template for styles email-styles.php, see Github issue https://github.com/woothemes/woocommerce/issues/5512 and must have gotten some help from a developer per e-mail.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function kill_defaults($tags) { | |
return array(); | |
} | |
add_filter( 'woocommerce_email_style_inline_tags', 'kill_defaults', 20 ); | |
add_filter( 'woocommerce_email_style_inline_h1_tag', 'kill_defaults', 20 ); | |
add_filter( 'woocommerce_email_style_inline_h2_tag', 'kill_defaults', 20 ); | |
add_filter( 'woocommerce_email_style_inline_h3_tag', 'kill_defaults', 20 ); | |
add_filter( 'woocommerce_email_style_inline_a_tag', 'kill_defaults', 20 ); | |
add_filter( 'woocommerce_email_style_inline_img_tag', 'kill_defaults', 20 ); | |
function my_email_style_inline_tags($tags) { | |
if (!in_array('h2', $tags)) $tags[] = 'h2'; | |
if (!in_array('h3', $tags)) $tags[] = 'h3'; | |
if (!in_array('ul', $tags)) $tags[] = 'ul'; | |
if (!in_array('li', $tags)) $tags[] = 'li'; | |
return $tags; | |
} | |
add_filter('woocommerce_email_style_inline_tags', 'my_email_style_inline_tags', 30); | |
function my_email_style_inline_h2_tag($styles) { | |
$styles['font-size'] = '1em'; | |
$styles['font-family'] = 'Arial, sans-serif'; | |
$styles['font-weight'] = 'bold'; | |
return $styles; | |
} | |
function my_email_style_inline_ul_tag($styles) { | |
$styles['margin-left'] = '1em'; | |
$styles['padding-left'] = '0'; | |
$styles['list-style'] = 'none'; | |
return $styles; | |
} | |
function my_email_style_inline_h3_tag($styles) { | |
$styles['font-size'] = '1em'; | |
$styles['margin-bottom'] = '0'; | |
$styles['font-weight'] = 'normal'; | |
$styles['font-family'] = 'Arial, sans-serif'; | |
return $styles; | |
} | |
function my_email_style_inline_li_tag($styles) { | |
$styles['margin-left'] = '0'; | |
return $styles; | |
} | |
add_filter('woocommerce_email_style_inline_h2_tag', 'my_email_style_inline_h2_tag', 30); | |
add_filter('woocommerce_email_style_inline_h3_tag', 'my_email_style_inline_h3_tag', 30); | |
add_filter('woocommerce_email_style_inline_ul_tag', 'my_email_style_inline_ul_tag', 30); | |
add_filter('woocommerce_email_style_inline_li_tag', 'my_email_style_inline_li_tag', 30); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment