WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| 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() ?>" title="<?php echo esc_attr( get_the_title() ? get_the_title() : get_the_ID() ); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a> |
| 578 | <?php if ( $show_date ) : ?> |