New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links in WooCommerce emails using 'Email Body Text Colour' #5512

Closed
Willem-Siebe opened this Issue May 19, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@Willem-Siebe

Hi,

I am changing the WooCommerce e-mails to very simple emails, so I removed all CSS in the files:

  • email-header.php;
  • email-footer.php;
  • admin-new-order.php.

What I don't understand, is that the links I am using in my admin-new-order.php, like this:

<a href="<?php echo admin_url( 'post.php?post=' . $order->id . '&action=edit' ); ?>"><?php printf( __( '%s', 'woocommerce'), $order->get_order_number() ); ?></a>

are using the 'Email Body Text Colour' I selected in the WP-backend. But why are my own templates using this anyways, since I removed all CSS. See included images.

2014-05-19_15-26-21
2014-05-19_15-27-42

@mikejolley

This comment has been minimized.

Show comment
Hide comment
@mikejolley

mikejolley Jun 3, 2014

Member

Most email clients strip HTML and CSS code, so when creating the template, the styles are added inline. This is why the colours will still be used even if you take out the styles in header.

Member

mikejolley commented Jun 3, 2014

Most email clients strip HTML and CSS code, so when creating the template, the styles are added inline. This is why the colours will still be used even if you take out the styles in header.

@mikejolley mikejolley closed this Jun 3, 2014

@Willem-Siebe

This comment has been minimized.

Show comment
Hide comment
@Willem-Siebe

Willem-Siebe Jun 15, 2014

Hi Mike,

I don't understand what you are trying to tell me.

In WooCommerce backend you can set 4 different colours as I showed you in the image.

In the original email-header.php from WooCommerce this is being included:

// Load colours
$bg         = get_option( 'woocommerce_email_background_color' );
$body       = get_option( 'woocommerce_email_body_background_color' );
$base       = get_option( 'woocommerce_email_base_color' );
$base_text  = wc_light_or_dark( $base, '#202020', '#ffffff' );
$text       = get_option( 'woocommerce_email_text_color' );

However, in my OWN email-header.php I'm not using ANY CSS at all. See below:

<?php
/**
 * Email Header
 *
 * @author      WooThemes
 * @package     WooCommerce/Templates/Emails
 * @version     2.0.0
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title><?php echo get_bloginfo( 'name' ); ?></title>
    </head>
    <body>

But still some HTML in my email is using the color value of 'Email Body Text Colour!

I just don't understand how that is possible...

Kind regards,

Willem

Hi Mike,

I don't understand what you are trying to tell me.

In WooCommerce backend you can set 4 different colours as I showed you in the image.

In the original email-header.php from WooCommerce this is being included:

// Load colours
$bg         = get_option( 'woocommerce_email_background_color' );
$body       = get_option( 'woocommerce_email_body_background_color' );
$base       = get_option( 'woocommerce_email_base_color' );
$base_text  = wc_light_or_dark( $base, '#202020', '#ffffff' );
$text       = get_option( 'woocommerce_email_text_color' );

However, in my OWN email-header.php I'm not using ANY CSS at all. See below:

<?php
/**
 * Email Header
 *
 * @author      WooThemes
 * @package     WooCommerce/Templates/Emails
 * @version     2.0.0
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title><?php echo get_bloginfo( 'name' ); ?></title>
    </head>
    <body>

But still some HTML in my email is using the color value of 'Email Body Text Colour!

I just don't understand how that is possible...

Kind regards,

Willem

@Willem-Siebe

This comment has been minimized.

Show comment
Hide comment
@Willem-Siebe

This comment has been minimized.

Show comment
Hide comment
@Willem-Siebe

Willem-Siebe Jun 15, 2014

Ok, the solution should be found in the file I mentioned before, also explained here: #3653.

Here the example code to add in your functions.php file to give a inline style to other element then h1, h2, h3, a or img: #3597.

The only thing I don't manage to change is the inline styling for h1, h2, h3, a or img. I should be possible because this is explained:

woocommerce_email_style_inline_tags

This filter hook returns an array of tags which will have a default style applied to them - you can both remove and add any tags which you need for your theme's custom emails

But how to remove (unset) the standard h1, h2, h3, a & img styling to add your own...

Kind regards,

Willem

Ok, the solution should be found in the file I mentioned before, also explained here: #3653.

Here the example code to add in your functions.php file to give a inline style to other element then h1, h2, h3, a or img: #3597.

The only thing I don't manage to change is the inline styling for h1, h2, h3, a or img. I should be possible because this is explained:

woocommerce_email_style_inline_tags

This filter hook returns an array of tags which will have a default style applied to them - you can both remove and add any tags which you need for your theme's custom emails

But how to remove (unset) the standard h1, h2, h3, a & img styling to add your own...

Kind regards,

Willem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment