WordPress首页右侧调用最新评论内容
1、修改 WordPress目录下的\wp-content\languages\zh_CN.po
2、先在网络上抓个Poedit下来,安装好,当然有Chinese Simplifed就再好不过了,编辑Wordpress目录下的\wp-content\languages\zh_CN.po
3、搜索“上的评论” 定位到第一个搜索到的“上的评论” ,可以发现是这样的:
原文:%1$s on %2$s
译文:%1$s 在 %2$s 上的评论
现在把译文改成这样:%1$s 说道: %2$s ,保存zh_CN.po,这时它会默认再生一个zh_CN.mo文件,然后上传这两个文件到\wp-content\languages\下覆盖掉原来的文件即可。
4、”wp-includes/default-widgets.php”文件中搜索”recentcomments”,找到如下代码:
5、if($comments){
foreach((array) $comments as $comment){
$output.=‘<li>’.sprintf(_x(‘%1$s on
%2$s’,‘widgets’),get_comment_author_link(),‘<a
href=”‘.esc_url(get_comment_link($comment->comment_ID) ) . ‘”>’ .
get_the_title($comment->comment_post_ID) . ‘</a>’) .
‘</li>’;
}
}
在这段代码中,把
get_the_title($comment->comment_post_ID) 替换成 strip_tags( $comment->comment_content)
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:119
阅读量:139
阅读量:30
阅读量:79
阅读量:109