Last active
March 2, 2022 23:37
-
-
Save kwcjr/b1c4cb9dcb3a51e54b0d0d359f175eaa to your computer and use it in GitHub Desktop.
Replace WooCommerce Subject line Preview Text ( drop in /wp-content/mu-plugins/ folder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Replace Pre-Header Email Text. | |
* Description: Replace Line 27 with what text you want. This will replace the text just after your Subject - "Your text". | |
* Author: Keith Crain ( Kronoslabs.io ) | |
* License: GNU General Public License v3 or later | |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
*/ | |
/** | |
* Pass custom email header to woocommerce. | |
* | |
* @param string 'woocommerce_email_header' Hook name to hook function into | |
* @param string 'klbs_custom_email_header' Function name to be hooked | |
*/ | |
add_action( 'woocommerce_email_header', 'klbs_custom_email_header', 10, 2 ); | |
/** | |
* Add preview text after subject line. | |
*/ | |
function klbs_custom_email_header( $email_heading, $email ) { | |
echo ' | |
<div style="max-height: 0px; overflow: hidden;"> | |
Insert hidden preheader text here. | |
</div> | |
<!-- Insert ͏‌ hack after hidden preview text --> | |
<div style="max-height: 0px; overflow: hidden;"> | |
͏‌ ͏‌ ͏‌ ͏‌ ͏‌ ͏‌ ͏‌ ͏‌ ͏‌ ͏‌ ͏‌ ͏‌ ͏‌ | |
</div> | |
'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment