'd_comment', 'description' => '显示网友最新评论(头像+名称+评论)' ); $this->WP_Widget( 'd_comment', 'Yusi-最新评论', $widget_ops, $control_ops ); } function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_name', $instance['title']); $limit = $instance['limit']; $outer = $instance['outer']; $outpost = $instance['outpost']; $more = $instance['more']; $link = $instance['link']; $mo=''; if( $more!='' && $link!='' ) $mo=''.$more.''; echo $before_widget; echo $before_title.$mo.$title.$after_title; echo '
comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_post_ID!='".$outpost."' AND user_id!='".$outer."' AND comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT $limit"; $comments = $wpdb->get_results($sql); foreach ( $comments as $comment ) { $output .= '