Add content to html emails

This commit is contained in:
Mike Jolley 2019-03-04 17:04:58 +00:00
parent 17a4c6e28a
commit f41070f91e
11 changed files with 83 additions and 41 deletions

View File

@ -48,6 +48,13 @@ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text,
*/ */
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
/**
* Show user-defined additonal content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/* /*
* @hooked WC_Emails::email_footer() Output the email footer * @hooked WC_Emails::email_footer() Output the email footer
*/ */

View File

@ -12,7 +12,7 @@
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates/Emails * @package WooCommerce/Templates/Emails
* @version 3.5.0 * @version 3.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -47,11 +47,13 @@ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text,
* @hooked WC_Emails::email_address() Shows email address * @hooked WC_Emails::email_address() Shows email address
*/ */
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
?>
<p> /**
<?php echo wp_kses_post( __( 'Hopefully theyll be back. Read more about <a href="https://docs.woocommerce.com/document/managing-orders/#section-10">troubleshooting failed payments</a>.', 'woocommerce' ) ); ?> * Show user-defined additonal content - this is set in each email's settings.
</p> */
<?php if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/* /*
* @hooked WC_Emails::email_footer() Output the email footer * @hooked WC_Emails::email_footer() Output the email footer

View File

@ -12,7 +12,7 @@
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates/Emails/HTML * @package WooCommerce/Templates/Emails/HTML
* @version 3.5.0 * @version 3.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
do_action( 'woocommerce_email_header', $email_heading, $email ); ?> do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php /* translators: %s: Customer billing full name */ ?> <?php /* translators: %s: Customer billing full name */ ?>
<p><?php printf( __( 'Youve received the following order from %s:', 'woocommerce' ), $order->get_formatted_billing_full_name() ); ?></p><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?> <p><?php printf( __( 'Youve received the following order from %s:', 'woocommerce' ), $order->get_formatted_billing_full_name() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
<?php <?php
/* /*
@ -47,6 +47,13 @@ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text,
*/ */
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
/**
* Show user-defined additonal content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/* /*
* @hooked WC_Emails::email_footer() Output the email footer * @hooked WC_Emails::email_footer() Output the email footer
*/ */

View File

@ -12,7 +12,7 @@
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates/Emails * @package WooCommerce/Templates/Emails
* @version 3.5.0 * @version 3.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -49,11 +49,12 @@ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text,
*/ */
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
?> /**
<p> * Show user-defined additonal content - this is set in each email's settings.
<?php esc_html_e( 'Thanks for shopping with us.', 'woocommerce' ); ?> */
</p> if ( $additional_content ) {
<?php echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/* /*
* @hooked WC_Emails::email_footer() Output the email footer * @hooked WC_Emails::email_footer() Output the email footer

View File

@ -51,11 +51,11 @@ do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php } else { ?> <?php } else { ?>
<p> <p>
<?php <?php
/* translators: %s Order date */ /* translators: %s Order date */
printf( esc_html__( 'Here are the details of your order placed on %s:', 'woocommerce' ), esc_html( wc_format_datetime( $order->get_date_created() ) ) ); printf( esc_html__( 'Here are the details of your order placed on %s:', 'woocommerce' ), esc_html( wc_format_datetime( $order->get_date_created() ) ) );
?> ?>
</p> </p>
<?php <?php
} }
/** /**
@ -83,6 +83,13 @@ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text,
*/ */
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
/**
* Show user-defined additonal content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/** /**
* Executes the email footer. * Executes the email footer.
* *

View File

@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php /* translators: %s Customer username */ ?> <?php /* translators: %s Customer username */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $user_login ) ); ?></p> <p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $user_login ) ); ?></p>
<?php /* translators: %1$s: Site title, %2$s: Username, %3$s: My account link */ ?> <?php /* translators: %1$s: Site title, %2$s: Username, %3$s: My account link */ ?>
<p><?php printf( __( 'Thanks for creating an account on %1$s. Your username is %2$s. You can access your account area to view orders, change your password, and more at: %3$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>', make_clickable( esc_url( wc_get_page_permalink( 'myaccount' ) ) ) ); ?></p><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?> <p><?php printf( __( 'Thanks for creating an account on %1$s. Your username is %2$s. You can access your account area to view orders, change your password, and more at: %3$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>', make_clickable( esc_url( wc_get_page_permalink( 'myaccount' ) ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
<?php if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) : ?> <?php if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) : ?>
<?php /* translators: %s Auto generated password */ ?> <?php /* translators: %s Auto generated password */ ?>

View File

@ -28,7 +28,7 @@ do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p> <p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
<p><?php esc_html_e( 'The following note has been added to your order:', 'woocommerce' ); ?></p> <p><?php esc_html_e( 'The following note has been added to your order:', 'woocommerce' ); ?></p>
<blockquote><?php echo wpautop( wptexturize( make_clickable( $customer_note ) ) ); ?></blockquote><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?> <blockquote><?php echo wpautop( wptexturize( make_clickable( $customer_note ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></blockquote>
<p><?php esc_html_e( 'As a reminder, here are your order details:', 'woocommerce' ); ?></p> <p><?php esc_html_e( 'As a reminder, here are your order details:', 'woocommerce' ); ?></p>
@ -53,6 +53,13 @@ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text,
*/ */
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
/**
* Show user-defined additonal content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/* /*
* @hooked WC_Emails::email_footer() Output the email footer * @hooked WC_Emails::email_footer() Output the email footer
*/ */

View File

@ -12,7 +12,7 @@
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates/Emails * @package WooCommerce/Templates/Emails
* @version 3.5.0 * @version 3.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -25,8 +25,8 @@ if ( ! defined( 'ABSPATH' ) ) {
do_action( 'woocommerce_email_header', $email_heading, $email ); ?> do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php /* translators: %s: Customer first name */ ?> <?php /* translators: %s: Customer first name */ ?>
<p><?php printf( __( 'Hi %s,', 'woocommerce' ), $order->get_billing_first_name() ); ?></p><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?> <p><?php printf( __( 'Hi %s,', 'woocommerce' ), $order->get_billing_first_name() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
<p><?php _e( 'Thanks for your order. Its on-hold until we confirm that payment has been received. In the meantime, heres a reminder of what you ordered:', 'woocommerce' ); ?></p><?php // phpcs:ignore WordPress.XSS.EscapeOutput ?> <p><?php esc_html_e( 'Thanks for your order. Its on-hold until we confirm that payment has been received. In the meantime, heres a reminder of what you ordered:', 'woocommerce' ); ?></p>
<?php <?php
@ -49,11 +49,12 @@ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text,
*/ */
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
?> /**
<p> * Show user-defined additonal content - this is set in each email's settings.
<?php _e( 'We look forward to fulfilling your order soon.', 'woocommerce' ); // phpcs:ignore WordPress.XSS.EscapeOutput ?> */
</p> if ( $additional_content ) {
<?php echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/* /*
* @hooked WC_Emails::email_footer() Output the email footer * @hooked WC_Emails::email_footer() Output the email footer

View File

@ -12,7 +12,7 @@
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates/Emails * @package WooCommerce/Templates/Emails
* @version 3.5.4 * @version 3.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -50,11 +50,12 @@ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text,
*/ */
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
?> /**
<p> * Show user-defined additonal content - this is set in each email's settings.
<?php esc_html_e( 'Thanks!', 'woocommerce' ); ?> */
</p> if ( $additional_content ) {
<?php echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/* /*
* @hooked WC_Emails::email_footer() Output the email footer * @hooked WC_Emails::email_footer() Output the email footer

View File

@ -12,7 +12,7 @@
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates/Emails * @package WooCommerce/Templates/Emails
* @version 3.5.0 * @version 3.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
do_action( 'woocommerce_email_header', $email_heading, $email ); ?> do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php /* translators: %s: Customer first name */ ?> <?php /* translators: %s: Customer first name */ ?>
<p><?php printf( __( 'Hi %s,', 'woocommerce' ), $order->get_billing_first_name() ); ?></p><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?> <p><?php printf( __( 'Hi %s,', 'woocommerce' ), $order->get_billing_first_name() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
<p> <p>
<?php <?php
@ -59,11 +59,12 @@ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text,
*/ */
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
?> /**
<p> * Show user-defined additonal content - this is set in each email's settings.
<?php _e( 'We hope to see you again soon.', 'woocommerce' ); // phpcs:ignore WordPress.XSS.EscapeOutput ?> */
</p> if ( $additional_content ) {
<?php echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/* /*
* @hooked WC_Emails::email_footer() Output the email footer * @hooked WC_Emails::email_footer() Output the email footer

View File

@ -36,4 +36,12 @@ if ( ! defined( 'ABSPATH' ) ) {
</a> </a>
</p> </p>
<?php do_action( 'woocommerce_email_footer', $email ); ?> <?php
/**
* Show user-defined additonal content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
do_action( 'woocommerce_email_footer', $email );