最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
WordPress文章显示评论内容而不是标题
时间:2013-09-07 编辑:简简单单 来源:一聚教程网
首先找到根目录下的 wp_includes/default-widgets.php,在functionwidget`(第625行左右)里面找
到以下代码(第655行左右):
代码如下 | 复制代码 |
if ( $comments ) { author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), ($comment->comment_post_ID) . '') . ' } } |
将第三行中的
代码如下 | 复制代码 |
get_the_title($comment->comment_post_ID) 改成 strip_tags( $comment- >comment_content), |
同时将sprintf里的on改成你想要显示的文字,如『说』,这样样式就变成
『评论者』说『评论内容』 以下是修改后的代码(注意:修改代码前请先备份)
代码如下 | 复制代码 |
if ( $comments ) { author, 2: post link */ sprintf(_x('%1$s said: %2$s', 'widgets'), get_comment_author_link (), '' . strip_tags (($comment->comment_content) . '') . ' } } |
其实这个$output就是输出html代码,所以可以在此根据自己的需要作出修改。
相关文章
- WordPress不显示博主自己的评论 05-05
- WordPress 评论添加楼层显示两种方法 06-03
- wordpress中首页文章下显示评论内容 06-03
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31