Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/248.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 跟进-为每种电子邮件类型提供不同的邮件头_Php_Wordpress_Woocommerce_Header_Email Notifications - Fatal编程技术网

Php 跟进-为每种电子邮件类型提供不同的邮件头

Php 跟进-为每种电子邮件类型提供不同的邮件头,php,wordpress,woocommerce,header,email-notifications,Php,Wordpress,Woocommerce,Header,Email Notifications,目标 将某些特定电子邮件的默认email-header.php替换为自定义电子邮件头。我希望指向分开的电子邮件头模板文件 我有 WordPress:4.9.1 商业:3.2.5 这是一个基于此处提供的解决方案的问题: 我遵循@helgatheviking提供的代码解决方案: 可能由于WP和WC的变化,前面提供的解决方案不起作用 在我的functions.php中 function so_27400044_remove_email_header(){ remove_action(

目标 将某些特定电子邮件的默认email-header.php替换为自定义电子邮件头。我希望指向分开的电子邮件头模板文件

我有 WordPress:4.9.1 商业:3.2.5

这是一个基于此处提供的解决方案的问题:

我遵循@helgatheviking提供的代码解决方案:

可能由于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' );
<?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php wc_get_template( 'emails/admin-new-order-header.php', array( 'email_heading' => $email_heading ) ) ; ?>
我为这封管理新订单电子邮件创建了一个新的头文件,并在我的Admin-new-Order.php中添加了引用

    function so_27400044_remove_email_header(){
    remove_action( 'woocommerce_email_header', 'email_header');
}
add_action( 'init', 'so_27400044_remove_email_header' );
<?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php wc_get_template( 'emails/admin-new-order-header.php', array( 'email_heading' => $email_heading ) ) ; ?>

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

请引导我


非常感谢

由于目前无法在WooCommerce 3.2+中删除默认的电子邮件标题,您应该从这些特定的电子邮件模板中删除以下代码行:

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

然后只需添加(您的自定义模板):



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

可能的重复我已经提到了对原始线程的引用,并将其链接到了原始线程。现在有没有可能的otner方法?@melvin使这成为可能,但这是StackOverFlow中无法问到的内容,而且对每个人都非常具体。