'widget_mfn_recent_comments', 'description' => __( 'The most recent comments.', 'mfn-opts' ) ); parent::__construct( 'widget_mfn_recent_comments', __( 'Muffin Recent Comments', 'mfn-opts' ), $widget_ops ); $this->alt_option_name = 'widget_mfn_recent_comments'; } /* --------------------------------------------------------------------------- * Outputs the HTML for this widget. * --------------------------------------------------------------------------- */ function widget( $args, $instance ) { if ( ! isset( $args['widget_id'] ) ) $args['widget_id'] = null; extract( $args, EXTR_SKIP ); echo $before_widget; $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base); if( $title ) echo $before_title . $title . $after_title; $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => intval( $instance['count']), 'status' => 'approve', 'post_status' => 'publish', 'post_type' => 'post' ) ) ); if(is_array($comments)) { $output = '
'; foreach($comments as $comment) { $url = get_permalink($comment->comment_post_ID).'#comment-'.$comment->comment_ID .'" title="'.$comment->comment_author .' | '.get_the_title($comment->comment_post_ID); $output .= '- ';
$output .= ''. date_i18n( get_option( 'date_format' ), strtotime( $comment->comment_date ) ) .'';
$output .= '
';
}
$output .= '
'; $output .= ''.strip_tags($comment->comment_author) .' '. __('commented on','mfn-opts') .' '. get_the_title($comment->comment_post_ID) .'
'; $output .= '