'Recent Comments', 'comments_number' => '5', 'display_author' => 'true', 'display_comment' => 'true', 'display_avatar' => 'true', 'read_more_text' => '»', 'comment_length' => '26', 'avatar_size' => '32', 'avatar_align' => 'alignleft' ); $theme->options['widgets_options']['comments'] = is_array($theme->options['widgets_options']['comments']) ? array_merge($themater_comments_defaults, $theme->options['widgets_options']['comments']) : $themater_comments_defaults; add_action('widgets_init', create_function('', 'return register_widget("ThematerComments");')); class ThematerComments extends WP_Widget { function __construct() { $widget_options = array('description' => __('Advanced widget for displaying the recent posts with avatars', 'themater') ); $control_options = array( 'width' => 400); $this->WP_Widget('themater_comments', '» Comments with Avatars', $widget_options, $control_options); } function widget($args, $instance) { global $wpdb, $theme; extract( $args ); $title = apply_filters('widget_title', $instance['title']); $comments_number = $instance['comments_number']; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,50) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT $comments_number"; $comments = $wpdb->get_results($sql); ?>
options['widgets_options']['comments'] ); ?>