Wordpress免插件版读者墙 » 荒野无灯weblog

Keep It Simple, Stupid.

荒野无灯weblog

Wordpress免插件版读者墙

这个东东已经有好多人写了。记录下来,作个记号,对google说:我曾经折腾过这个!

0×01:页面版读者墙(页面结构可根据自己风格修改):





comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->posts.ID=$wpdb->comments.comment_post_ID) WHERE comment_date > date_sub( NOW(), INTERVAL 1 MONTH ) AND user_id='0' AND comment_author_email != '你自己的email地址' AND post_password='' AND comment_approved='1' AND comment_type='') AS tempcmt GROUP BY comment_author_email ORDER BY cnt DESC LIMIT 40"; $wall = $wpdb->get_results($query); foreach ($wall as $comment) { if( $comment->comment_author_url ) $url = $comment->comment_author_url; else $url="#"; $tmp = "".get_avatar($comment->comment_author_email, 40).""; $output .= $tmp; } $output = "

Most Active Friends

".$output."
"; echo $output ; ?>

0×02:侧边栏版

活跃读者

    get_results("SELECT COUNT(comment_ID) AS cnt, comment_author, comment_author_url, comment_author_email FROM (SELECT * FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->posts.ID=$wpdb->comments.comment_post_ID) WHERE comment_date > date_sub( NOW(), INTERVAL 1 MONTH ) AND user_id='0' AND comment_author != '荒野无灯' AND post_password='' AND comment_approved='1' AND comment_type='') AS tempcmt GROUP BY comment_author ORDER BY cnt DESC LIMIT 12"); foreach ($wall as $item) { $c_url = $item->comment_author_url; if ($c_url == '') $c_url = '#'; $mostactive .= '
  • ' . '' . get_avatar($item->comment_author_email, 40) . '
  • '; } echo $mostactive; ?>

来自ZWWoOoOo童鞋博客的侧边栏css 样式参考:

#sidebar .ffox_most_active li{ list-style:none; float:left; border:none; line-height:0; } 
#sidebar .ffox_most_active img.avatar{ width:38px; height:38px; border:1px solid #ddd;padding:2px;margin:0 1px 0 0;}

相关文章参考:
木木 童鞋 《WordPress 读者墙插件:Great Friend Wall》
ZWWoOoOo童鞋:WordPress 免插件读者墙 willin 版本
willin童鞋:《Wordpress 免插件版側邊欄讀者牆》

Tagged in : wordpress,免插件,读者墙,侧边栏

All Comments (0)
Gravatar image
No Comments