woocommerce 中新帐户电子邮件模板的自定义
Customization of new account email template in woocoommerce
我正在尝试在 woocoomerce 的新帐户邮件模板中添加页眉和页脚图像。新账号默认模板如下
我只想在此模板中添加页眉和页脚。(附上图片以便更好地说明)
问题 - 添加的图像未显示在用户的邮箱中。
我试过的-
我将 customer-new-account.php 文件复制到我的子主题文件夹并添加了图像。但它没有显示图像。
文件路径 -
my-child-theme/woocommerce/emails/customer-new-account.php.
我的自定义代码是-
defined( 'ABSPATH' ) || exit;
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<img src= 'Path of header image'>
<?php /* translators: %s: Customer username */ ?>
<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 */ ?>
<p><?php printf( esc_html__( '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 /* translators: %s: Auto generated password */ ?>
<p><?php printf( esc_html__( 'Your password has been automatically generated: %s', 'woocommerce' ), '<strong>' . esc_html( $user_pass ) . '</strong>' ); ?></p>
<?php endif; ?>
<?php
/**
* Show user-defined additional content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
<img src= 'Path of footer image'>
do_action( 'woocommerce_email_footer', $email );
有什么建议吗?
这可能是两件事。
我最好的猜测
是你没有把模板放在正确的位置。那是经典。所以如果是我,那么我会首先确保 'customer-new-account.php` 在正确的位置。也许在这里阅读更多相关信息 WooCommerce template structure
其他评论
- 也可能是一些缓存。好像记得缓存那些邮件很麻烦。
- 您是否尝试过在 WooCommerce 后端简单地设置一个新的 header-image(WooCommerce >> 设置 >> 电子邮件 >> Header 图片)?那里也有一个'Footer text'。
- 我经常在修改邮件时使用插件,因为它实际上是相当多的工作(只是让你知道)。
https
和 http
存在问题。我正在使用的域的 SSL 证书已过期。
由于这张图片没有显示在用户的邮箱中。修复 SSL 问题后,一切开始正常工作。
我正在尝试在 woocoomerce 的新帐户邮件模板中添加页眉和页脚图像。新账号默认模板如下
我只想在此模板中添加页眉和页脚。(附上图片以便更好地说明)
问题 - 添加的图像未显示在用户的邮箱中。
我试过的-
我将 customer-new-account.php 文件复制到我的子主题文件夹并添加了图像。但它没有显示图像。 文件路径 -
my-child-theme/woocommerce/emails/customer-new-account.php.
我的自定义代码是-
defined( 'ABSPATH' ) || exit;
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<img src= 'Path of header image'>
<?php /* translators: %s: Customer username */ ?>
<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 */ ?>
<p><?php printf( esc_html__( '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 /* translators: %s: Auto generated password */ ?>
<p><?php printf( esc_html__( 'Your password has been automatically generated: %s', 'woocommerce' ), '<strong>' . esc_html( $user_pass ) . '</strong>' ); ?></p>
<?php endif; ?>
<?php
/**
* Show user-defined additional content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
<img src= 'Path of footer image'>
do_action( 'woocommerce_email_footer', $email );
有什么建议吗?
这可能是两件事。
我最好的猜测
是你没有把模板放在正确的位置。那是经典。所以如果是我,那么我会首先确保 'customer-new-account.php` 在正确的位置。也许在这里阅读更多相关信息 WooCommerce template structure
其他评论
- 也可能是一些缓存。好像记得缓存那些邮件很麻烦。
- 您是否尝试过在 WooCommerce 后端简单地设置一个新的 header-image(WooCommerce >> 设置 >> 电子邮件 >> Header 图片)?那里也有一个'Footer text'。
- 我经常在修改邮件时使用插件,因为它实际上是相当多的工作(只是让你知道)。
https
和 http
存在问题。我正在使用的域的 SSL 证书已过期。
由于这张图片没有显示在用户的邮箱中。修复 SSL 问题后,一切开始正常工作。