当前位置: 首页 > 阿里云优惠 > 阿里云服务器优惠>> WordPress评论如何添加@reply功能 – WordPress 教程

WordPress评论如何添加@reply功能 – WordPress 教程


Wordpress评论如何添加@reply功能 – WordPress 教程
wordpress

一、WordPress的评论页comments.php添加如下JS代码:

<script language="javascript">//<![CDATA[function to_reply(commentID,author) {var nNd='@'+author+':';var myField;if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {myField = document.getElementById('comment');} else {return false;}if (document.selection) {myField.focus();sel = document.selection.createRange();sel.text = nNd;myField.focus();}else if (myField.selectionStart || myField.selectionStart == '0') {var startPos = myField.selectionStart;var endPos = myField.selectionEnd;var cursorPos = endPos;myField.value = myField.value.substring(0, startPos)+ nNd+ myField.value.substring(endPos, myField.value.length);cursorPos += nNd.length;myField.focus();myField.selectionStart = cursorPos;myField.selectionEnd = cursorPos;}else {myField.value += nNd;myField.focus();}}//]]></script>

二、在functions.php中加入如下代码:

function to_reply() {?><a onclick='to_reply("<?php comment_ID() ?>", "<?php comment_author();?>")' href="https://xyy1.com/27191.html#respond" style="cursor:pointer;"/>[@reply]</a><?php}

三、在评论页后边添加”回复按钮”

<?php to_reply(); ?>

服务器购买/咨询热线:1563700917115617636856

本文链接:http://www.sqxnmj.com/alfwq/28588.html
tags:
腾讯云服务器特惠

  • 关注微信
是否收录:

猜你喜欢

微信公众号