-
Notifications
You must be signed in to change notification settings - Fork 0
/
readerwall.php
52 lines (52 loc) · 3.04 KB
/
readerwall.php
1
<?php/*Template Name: 阅读墙*/?><?php get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main" class="border-page-2 border-page-1"> <?php if(function_exists('cmp_breadcrumbs')) cmp_breadcrumbs();?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'template', 'page' ); ?> <?php endwhile; ?> <div id="dzq"> <?php $query="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 24 MONTH ) AND user_id='0' AND comment_author_email != '343430258@qq.com' AND post_password='' AND comment_approved='1' AND comment_type='') AS tempcmt GROUP BY comment_author_email ORDER BY cnt DESC LIMIT 50"; $wall = $wpdb->get_results($query); $maxNum = $wall[0]->cnt; foreach ($wall as $comment) { $width = round(40/($maxNum / $comment->cnt),2); if( $comment->comment_author_url ) $url = $comment->comment_author_url; else $url="#"; $avatar = get_avatar( $comment->comment_author_email, $size = '36'); $tmp = "<li><a target=\"_blank\" href=\"".$comment->comment_author_url."\" title=\"".$comment->comment_author_url."\">".$avatar."<em>".$comment->comment_author."</em> <span>+".$comment->cnt."</span></br></a></li>"; $output .= $tmp; } $output = "<ul class=\"readers-list\">".$output."</ul>"; echo $output ; ?> </div> </div> <?php if (comments_open()) comments_template( '', true ); ?> </div><?php get_footer(); ?><style>.site-content {width: auto;}.post-link-share {display:none;}#dzq {padding:0px 16px 15px;background-color: #fff; margin-top: -10px;}.readers-list{line-height:18px;text-align:left;overflow:hidden;_zoom:1}.readers-list li{width:185px;float:left;*margin-right:-1px}.readers-list a,.readers-list a:hover span{background-color:#f2f2f2;background-image:-webkit-linear-gradient(#f8f8f8,#f2f2f2);background-image:-moz-linear-gradient(#f8f8f8,#f2f2f2);background-image:linear-gradient(#f8f8f8,#f2f2f2)}.readers-list a{position:relative;display:block;height:36px;margin:4px;padding:4px 4px 4px 44px;color:#999;overflow:hidden;border:#ccc 1px solid;border-radius:2px;box-shadow:#eee 0 0 2px}.readers-list img,.readers-list em,.readers-list span{-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out}.readers-list img{width:36px;height:36px;float:left;margin:0 8px 0 -40px;}.readers-list em{color:#666;font-style:normal;margin-right:10px;line-height: 35px;}.readers-list span{width:40px;text-align:right;position:absolute;right:6px;top:0px;}.readers-list a:hover{border-color:#bbb;box-shadow:#ccc 0 0 2px;background-color:#fff;background-image:none}.readers-list a:hover img{opacity:.7;margin-left:0}.readers-list a:hover em{color:#FF5E52;}.readers-list a:hover span{color:#FF5E52;right:135px;top:0;text-align:center;border-right:#ccc 1px solid;height:44px;line-height:43px}</style>