-
Create sub theme (optional): If you have not created a sub theme, first create a sub theme. This will ensure that your changes are not lost when the theme is upgraded. You can place subtheme folders in the wpcontent/themes/
Directory and create a style.css
Files to create subthemes.
-
Find the comment notification mail template file: The template of the comment notification mail is usually located in the subject folder. Common file names are comments.php
or commenttemplate.php
。
-
Edit mail template file: Open the comment notification mail template file using the code editor. You can find HTML and PHP code in the template file, which is used to generate mail content. You can modify the style, layout, and content of the message according to your needs.
-
Use template tags: WordPress usually uses template tags to obtain dynamic content, such as the name of the comment author, comment content, etc. Make sure you do not delete these tags, otherwise the message may not work properly.
-
Save and Test: Save your changes and test them. You can post a comment in the WordPress background, and then check your email to see if the changes take effect.
-
Use plug-in (optional): If you are not familiar with programming or do not want to edit the template file manually, you can use the WordPress plug-in to customize the style of the comment notification email. Some plug-ins allow you to easily customize mail templates.
-
Custom style: You can use inline CSS or link to an external CSS file in the message template to customize the style of the message. Make sure your CSS doesn't break the layout of your mail.