comments.comment_post_ID) AS 'stammy' 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 post_date > '$lastmonth' AND comment_status = 'open' GROUP BY $wpdb->comments.comment_post_ID ORDER BY stammy DESC LIMIT ".$pop_posts; $posts = $wpdb->get_results($popularposts); $popular = ''; if($posts){ foreach($posts as $post){ $post_title = stripslashes($post->post_title); $guid = get_permalink($post->ID); $custom_field = get_post_meta($post->ID, "image", true); ?>