【发布时间】:2022-01-22 01:21:21
【问题描述】:
我正在尝试在 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 );
有什么建议吗?
【问题讨论】:
标签: php wordpress woocommerce wordpress-theming