wordpress 截取指定 作者,用户评论

2011-09-1411,9429

好久木有更新了 最近研究个人资料页面研究 到头痛最近有手痛悲剧悲剧

代码不是自己写 而是用网上的代码改写出来的

<?php //最新回复
global $wpdb;
$id = '1'; //这是指定用户id 当然你可以自动截取文章用户id 截取方式下面
//$id = $curauth->ID;  //这是用户id自动截取
    $sql = "SELECT DISTINCT ID, post_title, post_password,user_id, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,100) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' AND user_id = '$id' ORDER BY comment_date_gmt DESC  LIMIT 10";
    $comments = $wpdb->get_results($sql);
    $output = $pre_html;

    foreach ($comments as $comment) { $output .= "\n<li>".strip_tags($comment->comment_author)
        .":" . " <a href=\"" . get_permalink($comment->ID) ."#comment-" . $comment->comment_ID . "\" title=\"on " .$comment->post_title . "\">" . strip_tags($comment->com_excerpt)
            ."</a></li>";
            }

        $output .= $post_HTML;
echo $output;?>

</ul>

另外新主题即将完成...
未完成主题网站 各种排版演示
1.单栏主题 http://www.rini.me/
2.全局排版 综合 的http://www.nosub.tv/
3.出售展示 http://72.41.133.230/
4.blog展示 http://www.lianyue.org

2 0