Align center for mails subject
-
Hello,
How can I set/align all outgoing mails’ subject line texts to center?
Thanks in advance!
-
Make a child theme.
Copy:
wp-content/plugins/woocommerce/templates/emails/email-styles.php
to
wp-content/themes/my-child-theme-name/woocommerce/emails/email-styles.phpIn the copy, find the h1 section, then change the text-align property to
text-align: center;Hi Lorro,
Thank you for helping. Can I just copy and edit this part only?
h1 {
color: <?php echo esc_attr( $base ); ?>;
font-family: “Helvetica Neue”, Helvetica, Roboto, Arial, sans-serif;
font-size: 30px;
font-weight: 300;
line-height: 150%;
margin: 0;
text-align: <?php echo is_rtl() ? ‘right’ : ‘left’; ?>;
text-shadow: 0 1px 0 <?php echo esc_attr( $base_lighter_20 ); ?>;
}Yes.
Thanks a lot!!
Your post that I said Yes to was edited after I posted. I said Yes, you shouldn’t have the /templates/ folder in the target path.
No, you can’t just copy the h1 section and edit that. You need to copy the whole file and edit the h1 section in the copy.
For the benefit of those that may come here later.
@lorro, Thank you for reminder.
How can I edit h1 to align to ‘center’ from following code?
text-align: <?php echo is_rtl() ? ‘right’ : ‘left’; ?>;I don’t under stand why the original code using ‘right’ : ‘left’; it is confusing me.
That’s for some languages that use left to right text and others that use right to left text. Take out that line and replace it with
text-align: center;Hello @lorro,
I got this error alert:
————————————
PHP Parse error: syntax error, unexpected end of file in /home/mysite.com/wp-content/themes/twentyeleven-child/woocommerce/emails/email-styles.php on line 228
———————————
The ending line 228 is <?php, that I copied from entire original file I can see.I don’t get email notification at all now (maybe client same too) due to above error. Can you help?
Thanks in advance!
Please post the whole thing here: https://pastebin.com/ and post just the link in this forum.
There should be a newline after the last
<?php. So:<?phpAdd one more line 229 with <?php
So ending with double <?php ?The ending like this:
<?php
<?phpIs that right?
Thank in advance!
Just tested and got error logs again for the last two lines of <?php
Instead, I deleted last two <?php, goes ending with }, test from email template in setting, it seems like the email working now. No error log created.
And also, the “text-align:center” does’t work from the email template look up. I can see still showing “left” from chrome inspec tools.
No, only one
<?php, then press return, so the last line is a blank line. This is how it is in the original template. When you copied it, you didn’t copy the last empty line.Removing the
<?phpaltogether should work.text-align: center;must have a semi-colon at the end.
The topic ‘Align center for mails subject’ is closed to new replies.