Forked from whatthefork/woocommerce-add-css-to-emails.php
Created
November 15, 2024 15:19
-
-
Save piotroq/11a3359d93b22f641b3e3215dff872a0 to your computer and use it in GitHub Desktop.
Revisions
-
BFTrick revised this gist
Oct 8, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ <?php /** * Plugin Name: WooCommerce Add CSS to Emails * Plugin URI: https://gist.github.com/BFTrick/01cc414ee56ce93715ec * Description: Add CSS styles to WooCommerce emails * Author: Patrick Rauland * Author URI: http://speakinginbytes.com/ -
BFTrick created this gist
Oct 8, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,80 @@ <?php /** * Plugin Name: WooCommerce Add CSS to Emails * Plugin URI: https://gist.github.com/BFTrick/_________ * Description: Add CSS styles to WooCommerce emails * Author: Patrick Rauland * Author URI: http://speakinginbytes.com/ * Version: 1.0 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ if ( ! class_exists( 'WC_Add_CSS_To_Email' ) ) : class WC_Add_CSS_To_Email { protected static $instance = null; /** * Initialize the plugin. * * @since 1.0 */ private function __construct() { if ( class_exists( 'WooCommerce' ) && class_exists( 'WC_Emails' ) ) { // set subject add_filter( 'woocommerce_email_styles', array( $this, 'add_styles' ) ); } } /** * Return the CSS for WooCommerce emails * * @return string css for emails * @since 1.0 */ public function add_styles( $css ) { $css = $css . "p {color: red}"; return $css; } /** * Return an instance of this class. * * @return object A single instance of this class. * @since 1.0 */ public static function get_instance() { // If the single instance hasn't been set, set it now. if ( null == self::$instance ) { self::$instance = new self; } return self::$instance; } } add_action( 'admin_init', array( 'WC_Add_CSS_To_Email', 'get_instance' ), 0 ); endif;