本文实例讲述了wordpress主题评论中增加回复的办法。分享给大家供大家参考。详细如下:
很多冤家要给本人主题评论加个@reply回复成果,都会抉择用插件,其实咱们能够齐全修正源码来完成,这里就来给大家引见wordpress主题评论中怎样增加@reply回复.
办法如下:
一、在评论页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>
//@reply回复性能
function to_reply() {
?>
<a onclick='to_reply("<?php comment_ID() ?>", "<?php comment_author();?>")' href="#respond" style="cursor:pointer;"/>[@reply]</a>
<?php
}
?>
<?php comment_author_link() ?>
后边增加”回复按钮”,代码如下:<strong><?php to_reply(); ?></strong>
心愿本文所述对大家的WordPress建站有所协助。
以上就是安达网络工作室关于《wordpress主题评论中添加回复的方法》的一些看法。更多内容请查看本栏目更多内容!
update_user_option()函数 update_user_option()函数作用利用全局博客权限更新用户选项。 用户选项相似于用...
提醒:清算前请先备份数据库,以防出不测。 经理论发现,只需执行顺次执行上面5个语句,就能够清算的比拟洁...
WordPress 4.1 正式版公布,这次更新带来了2015主题(Twenty Fifteen),免干扰写作模式,暗藏各种芜杂以及...
以前小站的固定链接好不兽性化,构造是/%year%/%monthnum%/%postname%/,这样看起来又不直观又长的,明天做了一...
本文实例讲述了Wordpress将选中内容分享到新浪腾讯微博的办法。分享给大家供大家参考。详细办法如下: 1、引...
1.空间的抉择 wordpress要求 php+mysql的支持,rewrite性能,比方apache的mod-rewrite或iis rewrite。 空间...