I think some people are right. It may be better to stick code to github, but I love wordpress and I will not leave here. ** the original mail type defined by the system does not support HTML, so you need to hang a new hook: comment_icationication_headers ** functionxhd_mail2admin_2 () {if ($ comment-comment_author ){
I think some people are also right. It may be better to stick code to github, but I love wordpress. I will not leave here/** the original mail type defined by the system does not support HTML, so you need to hang a new hook: comment_icationication_headers **/function xhd_mail2admin_2 () {if (''= $ comment-comment_author ){
I think some people are also right. It may be better to stick code to github, but I love wordpress and I won't leave here.
/** The original mail type defined by the system does not support HTML. Therefore, a new hook is required: comment_icationication_headers **/function xhd_mail2admin_2 () {if (''= $ comment-> comment_author) {$ from =" From: \ "$ blogname \" <$ wp_email> "; if (''! = $ Comment-> comment_author_email) $ reply_to = "Reply-To: $ comment-> comment_author_email";} else {$ from = "From: \ "$ comment-> comment_author \" <$ wp_email> "; if (''! = $ Comment-> comment_author_email) $ reply_to = "Reply-To: \" $ comment-> comment_author_email \ "<$ comment-> comment_author_email> ";} $ message_headers = "$ from \ n ". "Content-Type: text/html; charset = \"". get_option ('blog _ charset '). "\" \ n "; return $ message_headers;} add_filter ('comment _ icationication_headers ', 'xhd _ mail2admin_2', 10, 2 ); /** beautification Based on yesterday's code **/function xhd_mail2admin ($ policy_message, $ comment_id) {$ comment = get_comment ($ comment_id ); $ post = get_post ($ comment-> comment_post_ID); $ author = get_userdata ($ post-> post_author); if ($ comment-> user_id = $ post-> post_author) return false; if ($ post-> post_author = get_current_user_id () return false; if (''= $ author-> user_email) return false; $ blogname = wp_specialchars_decode (get_option ('blogname'), ENT_QUOTES); $ IPURL =' http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip= '. $ Comment-> comment_author_IP; $ json = file_get_contents ($ IPURL); $ json = json_decode ($ json, true); $ json = $ json ["country"]. $ json ["province"]. $ json ["city"]. $ json ["district"]. $ json ["isp"]; $ policy_message = sprintf (__('
Your article "% s" has a new comment '), $ post-> post_title ).' | '; $ Policy_message. = sprintf (__('
Nickname: |
% S'), $ comment-> comment_author ).' | '; $ Policy_message. = sprintf (__('
IP: |
% 1 $ s (% 2 $ s) '), $ json, $ comment-> comment_author_IP ).' |
'; $ Policy_message. = sprintf (_ (' Website: |
% S'), $ comment-> comment_author_url ).' |
'; $ Domain1 = $ comment-> comment_author_url; $ domain = substr ($ domain1, 7); $ startUrl = "http://toolbarqueries.google.com/tbr? Client = navclient-auto & features = Rank & q = info: "; $ resultUrl = $ startUrl. $ domain. "& ch = ". app_hash_url ($ domain); $ array = get_headers ($ resultUrl, 1); if (! Preg_match ('/403/', $ array [0]) {$ pageContent = file_get_contents ($ resultUrl); $ pageRank = substr ($ pageContent, 9); $ policy_message. = sprintf (_ ('pr: |
% S'), $ pageRank ).' |
';} Else {$ policy_message. = _ ('pr: |
0 ').' |
';} $ Policy_message. = __(' Comment: |
'). $ Comment-> comment_content .' |
'; $ Policy_message. = sprintf (_ (' fixed link: |
% S'), get_comment_link ($ comment )).' |
'; If (EMPTY_TRASH_DAYS) $ policy_message. = sprintf (_ ('trash it: % s'), admin_url ("comment. php? Action = trash & c = $ comment_id "))."
"; Else $ policy_message. = sprintf (_ ('delete it: % s'), admin_url (" comment. php? Action = delete & c = $ comment_id "))."
"; $ Policy_message. = sprintf (_ ('spam it: % s'), admin_url (" comment. php? Action = spam & c = $ comment_id "))."
"; Return $ yy_message;} add_filter ('comment _ icationication_text ', 'xhd _ mail2admin', 10, 2 );
See the figure above for the effect
Original article address: In the topic function modification system Notification Email beautification article, thanks to the original author for sharing.