readers.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. template name: 读者墙
  4. description: template for yusi123.com Yusi theme
  5. */
  6. get_header();
  7. function readers_wall( $outer='1',$timer='100',$limit='60' ){
  8. global $wpdb;
  9. $counts = $wpdb->get_results("select count(comment_author) 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 $timer month ) and user_id='0' and comment_author != '".$outer."' and post_password='' and comment_approved='1' and comment_type='') as tempcmt group by comment_author order by cnt desc limit $limit");
  10. foreach ($counts as $count) {
  11. $c_url = $count->comment_author_url;
  12. if (!$c_url) $c_url = 'javascript:;';
  13. $type .= '<a id="duzhe" target="_blank" href="'. $c_url . '" title="['.$count->comment_author.']近期评论'. $count->cnt . '次">'.get_avatar( $count->comment_author_email, $size = '64' , deel_avatar_default() ).'<span>'.$count->comment_author.'</span></a>';
  14. }
  15. echo $type;
  16. };
  17. ?>
  18. <div class="pagewrapper clearfix">
  19. <aside class="pagesidebar">
  20. <ul class="pagesider-menu">
  21. <?php echo str_replace("</ul></div>", "", ereg_replace("<div[^>]*><ul[^>]*>", "", wp_nav_menu(array('theme_location' => 'pagemenu', 'echo' => false)) )); ?>
  22. </ul>
  23. </aside>
  24. <div class="pagecontent">
  25. <header class="pageheader clearfix">
  26. <h1 class="pull-left">
  27. <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
  28. </h1>
  29. <div class="pull-right">
  30. <?php deel_share() ?>
  31. </div>
  32. </header>
  33. <?php while (have_posts()) : the_post(); ?>
  34. <div class="article-content">
  35. <?php the_content(); ?>
  36. </div>
  37. <div class="readers">
  38. <?php readers_wall(); ?>
  39. </div>
  40. <?php comments_template('', true); endwhile; ?>
  41. </div>
  42. </div>
  43. <?php get_footer(); ?>