今天是我的生日,收到了很多同学朋友的贺电,在此先谢谢大家.特别是人人都是艺术家的朋友们.
步入正题.这个主题的原作者比较懒,造成这个主题比较简洁.这不,WP升到3.0了,他没有及时更新库函数,造成我前几天"最近评论"杯具了.
我的解决方法:直接篡改"function.php"里面的函数...
function get_recent_comments_only($no_comments = 10, $comment_lenth = 5, $before = '<li onmouseover=this.className="on"; onmouseout=this.className="off";>', $after = '</li>', $show_pass_post = false, $comment_style = 0) {
global $wpdb;
$request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, post_title FROM $wpdb->comments LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->comments.comment_post_ID WHERE post_status IN ('publish','static') ";
if(!$show_pass_post) $request .= "AND post_password ='' ";
$request .= "AND comment_approved = '1' ORDER BY comment_ID DESC LIMIT $no_comments";
$comments = $wpdb->get_results($request);
$output = '';
if ($comments) {
foreach ($comments as $comment) {
$comment_author = stripslashes($comment->comment_author);
if ($comment_author == "")
$comment_author = "anonymous";
$comment_content = strip_tags($comment->comment_content);
$comment_content = stripslashes($comment_content);
$words=split(" ",$comment_content);
$comment_excerpt = join(" ",array_slice($words,0,$comment_lenth));
$permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
if ($comment_style == 1) {
$post_title = stripslashes($comment->post_title);
$url = $comment->comment_author_url;
if (empty($url))
$output .= $before . $comment_author . ' on ' . $post_title . '.' . $after;
else
$output .= $before . "<a href='$url' rel='external'>$comment_author</a>" . ' on ' . $post_title . '.' . $after;
}
else {
$output .= $before . '' . $comment_author . ': <a href="' . $permalink;
$output .= '" title="View the entire comment by ' . $comment_author.'">' . $comment_excerpt.'</a>' . $after;
}
}
$output = convert_smilies($output);
} else {
$output .= $before . "None found" . $after;
}
echo $output;
}
这个函数是东拼西凑的函数.没有Gravatar,没有链接,防止PR传递.嘿嘿,我比较猥琐.
另外使用插件搞了一个评论嵌套,自己重写了CSS,使嵌套和原来的风格保持一致.作者的博客支持嵌套,但是他公布版本却不支持,估计是通过插件实现的.嗯嗯.
最后是修改了大量代码,让主题支持HTML5,并加入了一些猥琐的特效.IE6下面效果怎么样我不知道,反正我今天早上yum update的firefox效果非常好.
Comments