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.
This hook occurs 12 times in this file.
| Line | Code |
|---|---|
| 27 | /** |
| 28 | * Filter the widget title. |
| 29 | * |
| 30 | * @since 2.6.0 |
| 31 | * |
| 32 | * @param string $title The widget title. Default 'Pages'. |
| 33 | * @param array $instance An array of the widget's settings. |
| 34 | * @param mixed $id_base The widget ID. |
| 35 | */ |
| 36 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base ); |
| 37 | |
| 38 | $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; |
| 39 | $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; |
| 40 | |
| 41 | if ( $sortby == 'menu_order' ) |
| 42 | $sortby = 'menu_order, post_title'; |
| 43 | |
| 44 | /** |
| 45 | * Filter the arguments for the Pages widget. |
| Line | Code |
| 250 | parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops ); |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * @param array $args |
| 255 | * @param array $instance |
| 256 | */ |
| 257 | public function widget( $args, $instance ) { |
| 258 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 259 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 260 | |
| 261 | echo $args['before_widget']; |
| 262 | if ( $title ) { |
| 263 | echo $args['before_title'] . $title . $args['after_title']; |
| 264 | } |
| 265 | |
| 266 | // Use current theme search form if it exists |
| 267 | get_search_form(); |
| 268 | |
| Line | Code |
| 309 | /** |
| 310 | * @param array $args |
| 311 | * @param array $instance |
| 312 | */ |
| 313 | public function widget( $args, $instance ) { |
| 314 | $c = ! empty( $instance['count'] ) ? '1' : '0'; |
| 315 | $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; |
| 316 | |
| 317 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 318 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base ); |
| 319 | |
| 320 | echo $args['before_widget']; |
| 321 | if ( $title ) { |
| 322 | echo $args['before_title'] . $title . $args['after_title']; |
| 323 | } |
| 324 | |
| 325 | if ( $d ) { |
| 326 | $dropdown_id = "{$this->id_base}-dropdown-{$this->number}"; |
| 327 | ?> |
| Line | Code |
| 440 | parent::__construct('meta', __('Meta'), $widget_ops); |
| 441 | } |
| 442 | |
| 443 | /** |
| 444 | * @param array $args |
| 445 | * @param array $instance |
| 446 | */ |
| 447 | public function widget( $args, $instance ) { |
| 448 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 449 | $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base ); |
| 450 | |
| 451 | echo $args['before_widget']; |
| 452 | if ( $title ) { |
| 453 | echo $args['before_title'] . $title . $args['after_title']; |
| 454 | } |
| 455 | ?> |
| 456 | <ul> |
| 457 | <?php wp_register(); ?> |
| 458 | <li><?php wp_loginout(); ?></li> |
| Line | Code |
| 515 | parent::__construct('calendar', __('Calendar'), $widget_ops); |
| 516 | } |
| 517 | |
| 518 | /** |
| 519 | * @param array $args |
| 520 | * @param array $instance |
| 521 | */ |
| 522 | public function widget( $args, $instance ) { |
| 523 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 524 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 525 | |
| 526 | echo $args['before_widget']; |
| 527 | if ( $title ) { |
| 528 | echo $args['before_title'] . $title . $args['after_title']; |
| 529 | } |
| 530 | echo '<div id="calendar_wrap">'; |
| 531 | get_calendar(); |
| 532 | echo '</div>'; |
| 533 | echo $args['after_widget']; |
| Line | Code |
| 571 | parent::__construct('text', __('Text'), $widget_ops, $control_ops); |
| 572 | } |
| 573 | |
| 574 | /** |
| 575 | * @param array $args |
| 576 | * @param array $instance |
| 577 | */ |
| 578 | public function widget( $args, $instance ) { |
| 579 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 580 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 581 | |
| 582 | /** |
| 583 | * Filter the content of the Text widget. |
| 584 | * |
| 585 | * @since 2.3.0 |
| 586 | * |
| 587 | * @param string $widget_text The widget content. |
| 588 | * @param WP_Widget $instance WP_Widget instance. |
| 589 | */ |
| Line | Code |
| 648 | * @staticvar bool $first_dropdown |
| 649 | * |
| 650 | * @param array $args |
| 651 | * @param array $instance |
| 652 | */ |
| 653 | public function widget( $args, $instance ) { |
| 654 | static $first_dropdown = true; |
| 655 | |
| 656 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 657 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base ); |
| 658 | |
| 659 | $c = ! empty( $instance['count'] ) ? '1' : '0'; |
| 660 | $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; |
| 661 | $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; |
| 662 | |
| 663 | echo $args['before_widget']; |
| 664 | if ( $title ) { |
| 665 | echo $args['before_title'] . $title . $args['after_title']; |
| 666 | } |
| Line | Code |
| 810 | echo $cache[ $args['widget_id'] ]; |
| 811 | return; |
| 812 | } |
| 813 | |
| 814 | ob_start(); |
| 815 | |
| 816 | $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' ); |
| 817 | |
| 818 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 819 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 820 | |
| 821 | $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; |
| 822 | if ( ! $number ) |
| 823 | $number = 5; |
| 824 | $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; |
| 825 | |
| 826 | /** |
| 827 | * Filter the arguments for the Recent Posts widget. |
| 828 | * |
| Line | Code |
| 988 | echo $cache[ $args['widget_id'] ]; |
| 989 | return; |
| 990 | } |
| 991 | |
| 992 | $output = ''; |
| 993 | |
| 994 | $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' ); |
| 995 | |
| 996 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 997 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 998 | |
| 999 | $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; |
| 1000 | if ( ! $number ) |
| 1001 | $number = 5; |
| 1002 | |
| 1003 | /** |
| 1004 | * Filter the arguments for the Recent Comments widget. |
| 1005 | * |
| 1006 | * @since 3.4.0 |
| Line | Code |
| 1125 | $link = esc_url(strip_tags($rss->get_permalink())); |
| 1126 | while ( stristr($link, 'http') != $link ) |
| 1127 | $link = substr($link, 1); |
| 1128 | } |
| 1129 | |
| 1130 | if ( empty($title) ) |
| 1131 | $title = empty($desc) ? __('Unknown Feed') : $desc; |
| 1132 | |
| 1133 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 1134 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 1135 | |
| 1136 | $url = esc_url(strip_tags($url)); |
| 1137 | $icon = includes_url('images/rss.png'); |
| 1138 | if ( $title ) |
| 1139 | $title = "<a class='rsswidget' href='$url'><img style='border:0' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link'>$title</a>"; |
| 1140 | |
| 1141 | echo $args['before_widget']; |
| 1142 | if ( $title ) { |
| 1143 | echo $args['before_title'] . $title . $args['after_title']; |
| Line | Code |
| 1412 | if ( 'post_tag' == $current_taxonomy ) { |
| 1413 | $title = __('Tags'); |
| 1414 | } else { |
| 1415 | $tax = get_taxonomy($current_taxonomy); |
| 1416 | $title = $tax->labels->name; |
| 1417 | } |
| 1418 | } |
| 1419 | |
| 1420 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 1421 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 1422 | |
| 1423 | echo $args['before_widget']; |
| 1424 | if ( $title ) { |
| 1425 | echo $args['before_title'] . $title . $args['after_title']; |
| 1426 | } |
| 1427 | echo '<div class="tagcloud">'; |
| 1428 | |
| 1429 | /** |
| 1430 | * Filter the taxonomy used in the Tag Cloud widget. |
| Line | Code |
| 1506 | */ |
| 1507 | public function widget( $args, $instance ) { |
| 1508 | // Get menu |
| 1509 | $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false; |
| 1510 | |
| 1511 | if ( !$nav_menu ) |
| 1512 | return; |
| 1513 | |
| 1514 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 1515 | $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 1516 | |
| 1517 | echo $args['before_widget']; |
| 1518 | |
| 1519 | if ( !empty($instance['title']) ) |
| 1520 | echo $args['before_title'] . $instance['title'] . $args['after_title']; |
| 1521 | |
| 1522 | $nav_menu_args = array( |
| 1523 | 'fallback_cb' => '', |
| 1524 | 'menu' => $nav_menu |