2017-12-03 112 views
1

目的 与自定义的电子邮件标题一些特定的邮件替换默认电子邮件的header.php。我希望指向邮件头模板文件。跟进 - Woocommerce不同的页眉为每个电子邮件类型

我有 的WordPress:4.9.1 Woocommerce:3.2.5

这是基于该解决方案此处提供了一个问题: Woocommerce different headers for each email types

我跟着代码解决方案由@helgatheviking这里提供:https://stackoverflow.com/a/27406663/8044005

也许前面提供的解决方案是不是因为在WP &努力改变WC

在我的functions.php我有

function so_27400044_remove_email_header(){ 
    remove_action('woocommerce_email_header', 'email_header'); 
} 
add_action('init', 'so_27400044_remove_email_header'); 

我创建了这个管理的新订单电子邮件一个新的头文件和我的管理,新order.php添加了引用我有

<?php do_action('woocommerce_email_header', $email_heading, $email); ?> 
<?php wc_get_template('emails/admin-new-order-header.php', array('email_heading' => $email_heading)) ; ?> 

当我测试这封电子邮件时,我得到了两个标题!现有以及我创建的新标题!

请指导我。

非常感谢!

+0

可能重复[Woocommerce每个电子邮件类型不同的标题](https://stackoverflow.com/questions/27400044/woocommerce-different-headers-for-each-email-types) – localheinz

+0

我已经提到过原始线程并链接到它。 – KoolPal

回答

0

因为它不能删除默认的电子邮件标头现在WooCommerce 3.2+,你应该只从那些特定电子邮件删除模板下面的代码行:

<?php do_action('woocommerce_email_header', $email_heading, $email); ?> 

然后只需添加代替(自定义模板) :

<?php wc_get_template('emails/admin-new-order-header.php', array('email_heading' => $email_heading)) ; ?> 

我目前没有看到另一种方式。

相关问题