function get_comments($post_id) { global $wpdb, $table_prefix; $dbt_data_comment = $table_prefix . 'gdsr_data_comment'; GDSRDatabase::add_empty_comments($post_id); $sql = sprintf("select g.*, c.comment_content, c.comment_author, c.comment_author_email, c.comment_author_url, c.comment_date from %s c left join %s g on c.comment_ID = g.comment_ID where c.comment_approved = 1 and c.comment_type = '' and c.comment_post_id = %s order by c.comment_date desc", $wpdb->comments, $dbt_data_comment, $post_id); return $sql; }