From d8ff34710d819bc439e3d559e72ee4ba9ea2249b Mon Sep 17 00:00:00 2001 From: Patrick Rauland Date: Tue, 16 Dec 2014 11:32:54 -0700 Subject: [PATCH] adding email styles back to email preview. closes #6965 --- includes/admin/class-wc-admin.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/includes/admin/class-wc-admin.php b/includes/admin/class-wc-admin.php index b9df9d473da..fed4d57db39 100644 --- a/includes/admin/class-wc-admin.php +++ b/includes/admin/class-wc-admin.php @@ -114,17 +114,25 @@ class WC_Admin { die( 'Security check' ); } - global $email_heading; - - ob_start(); - - include( 'views/html-email-template-preview.php' ); - + // load the mailer class $mailer = WC()->mailer(); - $message = ob_get_clean(); + + // get the preview email subject $email_heading = __( 'HTML Email Template', 'woocommerce' ); - echo $mailer->wrap_message( $email_heading, $message ); + // get the preview email content + ob_start(); + include( 'views/html-email-template-preview.php' ); + $message = ob_get_clean(); + + // create a new email + $email = new WC_Email(); + + // wrap the content with the email template and then add styles + $message = $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ); + + // print the preview email + echo $message; exit; } }