Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: widget_posts_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
560           extract($args);
561
562           $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' );
563           $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
564           $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 10;
565           if ( ! $number )
566                 $number = 10;
567           $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
568
569           $r = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) ) );
570           if ($r->have_posts()) :
571 ?>
572           <?php echo $before_widget; ?>
573           <?php if ( $title ) echo $before_title . $title . $after_title; ?>
574           <ul>
575           <?php while ( $r->have_posts() ) : $r->the_post(); ?>
576                <li>
577                     <a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a>
578                <?php if ( $show_date ) : ?>