WordPress Post Hacks
WordPress Post Hacks
Create Your Own Popular Posts content in the sidebar
Highlighting the most popular posts on your site is a great way to send new visitors to your very best content and win them over.
There are a few different ways you can do this, and quite a few plugins out there to help. But why not base it on the number of comments? If you write a post that makes people talk, it must be a well written post (Most of the time…).
Popular Posts
< ?php $result = $wpdb->get_results(“SELECT comment_count,ID,post_title
FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5”);
foreach ($result as $post) {
setup_postdata($post);
$postid = $post->ID;
$title = $post->post_title;
$commentcount = $post->comment_count;
if ($commentcount != 0) { ?>