本文实例讲述了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主题评论中添加回复的方法》的一些看法。更多内容请查看本栏目更多内容!
get_header()(获取头部) 引入主题的头部模板,默许会引入以后主标题录里的 header.php 文件。假如指定了一...
Fatal error: Call to undefined method wpdb_2::delete() in /home/*/public_html/wp-includes/o...
WordPress 现有的备份办法和存在的成绩 关于 WordPress 博客来说,有很多备份的办法,数据库能够间接经过 P...
处理办法这是由于空间中的’C:\WINDOWS\TEMP’目录没有设置IIS拜访权限,需求空间商为你设置目录...
get_avatar()(获取头像) get_avatar() 函数用来获取置顶邮箱或许用户的头像代码,在评论列表中十分罕用。...
作为主题的制造者, 除了完成性能, 展现界面, 还有责任使主题灵敏多变, 以满足更多人不同的需要. 可能一些冤...