__('Advanced widget for displaying the recent comments with avatars', 'espania' ) ); $control_ops = array( 'width' => 400 ); parent::__construct( false, __( '» [Espania] Comments', 'espania' ), $widget_ops, $control_ops ); } function widget( $args, $instance ) { global $wpdb; 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, comment_content 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); echo $before_widget; echo $before_title; echo $title; echo $after_title; ?>
'Recent Comments', 'comments_number' => '5', 'display_author' => 'true', 'display_date' => 'true', 'display_comment' => 'true', 'display_avatar' => 'true', 'date_format' => 'n-j-Y', 'read_more_text' => '', 'comment_length' => '26', 'avatar_size' => '32', 'avatar_align' => 'alignleft' ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>