Top 5 view counts in order commet count
-
Hello,
I’m really interested to change the menu that show’s the top 5 mostly commented posts for the most viewed posts.
I have this code, that works perfectly for top 5 comments menu:<div class="top"> <span class="heading1"><span>Populiariausi straipsniai</span></span> <ul> <?php $sql = " SELECT * FROM $wpdb->posts WHERE post_date_gmt > ".(time()-strtotime('-2 weeks'))." AND post_type = 'post' ORDER BY comment_count DESC LIMIT 5 "; $top_posts = $wpdb->get_results($sql); foreach ($top_posts as $post) { ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><span><a class="comments" href="<?php the_permalink(); ?>#comments"><?php echo $post->comment_count; ?> Komentar?</a>Kategorijos: <?php the_category(', '); ?></span></li> <? } ?> </ul> </div> <div class="clear"></div> </div> <!-- // Featured / Top Articles --> <?php endif; ?>
Now I realy need to change it to the mostly viewed menu. I’m using PostViews plugin. Changing comment_count to view_count didn’t helped at all, I tryed even to change it in several ways, but i’m not so good with php ??
So I’m looking forward for any help. Thank You
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Top 5 view counts in order commet count’ is closed to new replies.