Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: widget_comments_args

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
662           }
663
664            extract($args, EXTR_SKIP);
665            $output = '';
666           $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Comments' ) : $instance['title'], $instance, $this->id_base );
667
668           if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
669                 $number = 5;
670
671           $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) );
672           $output .= $before_widget;
673           if ( $title )
674                $output .= $before_title . $title . $after_title;
675
676           $output .= '<ul id="recentcomments">';
677           if ( $comments ) {
678                foreach ( (array) $comments as $comment) {
679                     $output .=  '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
680                }