comments.comment_post_ID) AS 'popular' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' AND post_date < '$now' AND comment_status = 'open' GROUP BY $wpdb->comments.comment_post_ID ORDER BY popular DESC LIMIT $ap"; $posts = $wpdb->get_results($popularposts); $popular = ''; if($posts){ foreach($posts as $post){ $post_title = stripslashes($post->post_title); $post_date = stripslashes($post->post_date); $comments = stripslashes($post->comment_count); $guid = get_permalink($post->ID); $popular .= '
  • '.$post_title.' '.DISCUSSED.' '.$comments.' '.TIMES.'
  • '; } }echo $popular; ?>