解惑

解己之惑,解人之惑

不能显示最近评论

把worpress升级到3.0后猛然发现最新评论里面没有内容,google了下也没有什么结果,没有办法只能自己解决,发现我的最近评论是用的主题4U的u_get_recent_comments,对应的代码在functions.php里面,连到数据库上执行了下SQL,发现没有什么问题,改了下,把SQL打印出来,发现里面定义的变量tableposts和tablecomments没有,没有实际去确认是不是wordpress升级后把这两个全局变量干掉了,直接修改了functions.php:

function u_get_recent_comments($no_comments = 5, $before = ‘<li> ‘, $after = ‘</li>’, $show_pass_post = false) {

global $wpdb;
$tableposts = ‘wp_posts’;
$tablecomments = ‘wp_comments’;
$request = “SELECT ID, comment_ID, comment_content, comment_author FROM $tableposts, $tablecomments WHERE $tableposts.ID=$tablecomments.comment_post_ID AND (post_status = ‘publish’ OR post_status = ‘static’)”;

(Visited 115 times, 1 visits today)

2 Comments

  1. 不会吧
    我的评论 没有了?

  2. 不太喜欢wp这种模式
    函数太多
    感觉效率不高

月经进行回复 取消回复

邮箱地址不会被公开。 必填项已用*标注

© 2024 解惑

本主题由Anders Noren提供向上 ↑