Rat's

Add WeChat alerts to new comments in WordPress
Foreword All the friends who set up a website with Wordpress know that you can add email reminders when there are comments and replies to an article, either in php or smtp. But can
Scan the QR code on the right to read the full text
twenty-two
2016/12

Add WeChat alerts to new comments in WordPress

preface

All friends who set up a website with Wordpress know that you can add email reminders when there are comments and replies to an article, either in php or smtp. But can someone leave you a message and send you a WeChat push reminder? The answer is yes. Of course, there is a limitation here, which is just to remind the blogger himself that what he needs to prepare is a Github account and a WeChat account.
The service used is the server sauce. What is Server sauce?

 "Server Paste", named "ServerChan" in English, is a communication software between "programmer" and "server". Say something reasonable. It is a tool to push alarms and logs from the server to the mobile phone. It only takes one minute to open and use it: Login: log in to the website with GitHub account to get a SCKEY (on the "Send Message" page) Binding: click "WeChat push" to complete binding at the same time of scanning code Message: To http://sc.ftqq.com/SCKEY.send Send a GET request and you can receive messages on WeChat

As stated in the introduction of the server sauce, first log in through the GitHub account to obtain the SCKEY, and then replace the corresponding fields in the following code with your own SCKEY.

 //Comment WeChat push function sc_send($comment_id) { $text='There is a new comment on the blog'; $comment = get_comment($comment_id); $desp = $comment->comment_content; $key='Your own SCKEY'; $postdata = http_build_query( array( 'text' => $text, 'desp' => $desp ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); return $result = file_get_contents(' http://sc.ftqq.com/ '.$ key.'. send', false, $context); } add_action('comment_post', 'sc_send', 19, 2);

Paste this code to the end of function.php and save it. Finally, bind the WeChat of the server sauce, and you can receive comments from others to your blog from WeChat.
Original quotation: http://xiaolei.tech/gei-wordpress-de-xin-ping-lun-tian-jia-wei-xin-ti-xing.html

Vultr New user registration send one hundred USD/ sixteen Each computer room is charged by hour, and Alipay is supported【 Click to view 】。
Last modification: 07:02 PM, December 22, 2016

Comment