本文实例讲述了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主题评论中添加回复的方法》的一些看法。更多内容请查看本栏目更多内容!
本文实例讲述了Wordpress将选中内容分享到新浪腾讯微博的办法。分享给大家供大家参考。详细办法如下: 1、引...
首先列表会变得很臃肿,得到了列表的自身作用——不便用户寻觅真正想要看的帖子,其次,在搜寻引...
第一种办法:我的这个博客不断都在网上运转,明天想把它在本地架设一个,包括数据库都和网上的如出一辙。详...
get_post()(获取一篇文章) get_post() 函数能够依据 ID 查问一篇文章的信息,还能前往循环中的以后文章。...
明天收到了很多Bloger冤家的E-mail拜年短信,嘿嘿,觉得很好玩,可是他们是如何完成的这个呢,很简略的,可...
咱们先来看一下什么是nofollow。NoFollow是Google几年前提出的一个新标签,目的是缩小渣滓留言。此标签标明...