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 |
|---|---|
| 23 | /** |
| 24 | * Filter the widget title. |
| 25 | * |
| 26 | * @since 2.6.0 |
| 27 | * |
| 28 | * @param string $title The widget title. Default 'Pages'. |
| 29 | * @param array $instance An array of the widget's settings. |
| 30 | * @param mixed $id_base The widget ID. |
| 31 | */ |
| 32 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base ); |
| 33 | |
| 34 | $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; |
| 35 | $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; |
| 36 | |
| 37 | if ( $sortby == 'menu_order' ) |
| 38 | $sortby = 'menu_order, post_title'; |
| 39 | |
| 40 | /** |
| 41 | * Filter the arguments for the Pages widget. |
| Line | Code |
| 224 | |
| 225 | public function __construct() { |
| 226 | $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site.") ); |
| 227 | parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops ); |
| 228 | } |
| 229 | |
| 230 | public function widget( $args, $instance ) { |
| 231 | |
| 232 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 233 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 234 | |
| 235 | echo $args['before_widget']; |
| 236 | if ( $title ) { |
| 237 | echo $args['before_title'] . $title . $args['after_title']; |
| 238 | } |
| 239 | |
| 240 | // Use current theme search form if it exists |
| 241 | get_search_form(); |
| 242 | |
| Line | Code |
| 271 | $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site’s Posts.') ); |
| 272 | parent::__construct('archives', __('Archives'), $widget_ops); |
| 273 | } |
| 274 | |
| 275 | public function widget( $args, $instance ) { |
| 276 | $c = ! empty( $instance['count'] ) ? '1' : '0'; |
| 277 | $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; |
| 278 | |
| 279 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 280 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base ); |
| 281 | |
| 282 | echo $args['before_widget']; |
| 283 | if ( $title ) { |
| 284 | echo $args['before_title'] . $title . $args['after_title']; |
| 285 | } |
| 286 | |
| 287 | if ( $d ) { |
| 288 | $dropdown_id = "{$this->id_base}-dropdown-{$this->number}"; |
| 289 | ?> |
| Line | Code |
| 391 | |
| 392 | public function __construct() { |
| 393 | $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, & WordPress.org links.") ); |
| 394 | parent::__construct('meta', __('Meta'), $widget_ops); |
| 395 | } |
| 396 | |
| 397 | public function widget( $args, $instance ) { |
| 398 | |
| 399 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 400 | $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base ); |
| 401 | |
| 402 | echo $args['before_widget']; |
| 403 | if ( $title ) { |
| 404 | echo $args['before_title'] . $title . $args['after_title']; |
| 405 | } |
| 406 | ?> |
| 407 | <ul> |
| 408 | <?php wp_register(); ?> |
| 409 | <li><?php wp_loginout(); ?></li> |
| Line | Code |
| 455 | |
| 456 | public function __construct() { |
| 457 | $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s Posts.') ); |
| 458 | parent::__construct('calendar', __('Calendar'), $widget_ops); |
| 459 | } |
| 460 | |
| 461 | public function widget( $args, $instance ) { |
| 462 | |
| 463 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 464 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 465 | |
| 466 | echo $args['before_widget']; |
| 467 | if ( $title ) { |
| 468 | echo $args['before_title'] . $title . $args['after_title']; |
| 469 | } |
| 470 | echo '<div id="calendar_wrap">'; |
| 471 | get_calendar(); |
| 472 | echo '</div>'; |
| 473 | echo $args['after_widget']; |
| Line | Code |
| 500 | public function __construct() { |
| 501 | $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML.')); |
| 502 | $control_ops = array('width' => 400, 'height' => 350); |
| 503 | parent::__construct('text', __('Text'), $widget_ops, $control_ops); |
| 504 | } |
| 505 | |
| 506 | public function widget( $args, $instance ) { |
| 507 | |
| 508 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 509 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 510 | |
| 511 | /** |
| 512 | * Filter the content of the Text widget. |
| 513 | * |
| 514 | * @since 2.3.0 |
| 515 | * |
| 516 | * @param string $widget_text The widget content. |
| 517 | * @param WP_Widget $instance WP_Widget instance. |
| 518 | */ |
| Line | Code |
| 561 | |
| 562 | public function __construct() { |
| 563 | $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories." ) ); |
| 564 | parent::__construct('categories', __('Categories'), $widget_ops); |
| 565 | } |
| 566 | |
| 567 | public function widget( $args, $instance ) { |
| 568 | |
| 569 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 570 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base ); |
| 571 | |
| 572 | $c = ! empty( $instance['count'] ) ? '1' : '0'; |
| 573 | $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; |
| 574 | $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; |
| 575 | |
| 576 | echo $args['before_widget']; |
| 577 | if ( $title ) { |
| 578 | echo $args['before_title'] . $title . $args['after_title']; |
| 579 | } |
| Line | Code |
| 713 | echo $cache[ $args['widget_id'] ]; |
| 714 | return; |
| 715 | } |
| 716 | |
| 717 | ob_start(); |
| 718 | |
| 719 | $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' ); |
| 720 | |
| 721 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 722 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 723 | |
| 724 | $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; |
| 725 | if ( ! $number ) |
| 726 | $number = 5; |
| 727 | $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; |
| 728 | |
| 729 | /** |
| 730 | * Filter the arguments for the Recent Posts widget. |
| 731 | * |
| Line | Code |
| 868 | echo $cache[ $args['widget_id'] ]; |
| 869 | return; |
| 870 | } |
| 871 | |
| 872 | $output = ''; |
| 873 | |
| 874 | $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' ); |
| 875 | |
| 876 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 877 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 878 | |
| 879 | $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; |
| 880 | if ( ! $number ) |
| 881 | $number = 5; |
| 882 | |
| 883 | /** |
| 884 | * Filter the arguments for the Recent Comments widget. |
| 885 | * |
| 886 | * @since 3.4.0 |
| Line | Code |
| 994 | $link = esc_url(strip_tags($rss->get_permalink())); |
| 995 | while ( stristr($link, 'http') != $link ) |
| 996 | $link = substr($link, 1); |
| 997 | } |
| 998 | |
| 999 | if ( empty($title) ) |
| 1000 | $title = empty($desc) ? __('Unknown Feed') : $desc; |
| 1001 | |
| 1002 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 1003 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 1004 | |
| 1005 | $url = esc_url(strip_tags($url)); |
| 1006 | $icon = includes_url('images/rss.png'); |
| 1007 | if ( $title ) |
| 1008 | $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>"; |
| 1009 | |
| 1010 | echo $args['before_widget']; |
| 1011 | if ( $title ) { |
| 1012 | echo $args['before_title'] . $title . $args['after_title']; |
| Line | Code |
| 1269 | if ( 'post_tag' == $current_taxonomy ) { |
| 1270 | $title = __('Tags'); |
| 1271 | } else { |
| 1272 | $tax = get_taxonomy($current_taxonomy); |
| 1273 | $title = $tax->labels->name; |
| 1274 | } |
| 1275 | } |
| 1276 | |
| 1277 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 1278 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 1279 | |
| 1280 | echo $args['before_widget']; |
| 1281 | if ( $title ) { |
| 1282 | echo $args['before_title'] . $title . $args['after_title']; |
| 1283 | } |
| 1284 | echo '<div class="tagcloud">'; |
| 1285 | |
| 1286 | /** |
| 1287 | * Filter the taxonomy used in the Tag Cloud widget. |
| Line | Code |
| 1347 | |
| 1348 | public function widget($args, $instance) { |
| 1349 | // Get menu |
| 1350 | $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false; |
| 1351 | |
| 1352 | if ( !$nav_menu ) |
| 1353 | return; |
| 1354 | |
| 1355 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 1356 | $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 1357 | |
| 1358 | echo $args['before_widget']; |
| 1359 | |
| 1360 | if ( !empty($instance['title']) ) |
| 1361 | echo $args['before_title'] . $instance['title'] . $args['after_title']; |
| 1362 | |
| 1363 | $nav_menu_args = array( |
| 1364 | 'fallback_cb' => '', |
| 1365 | 'menu' => $nav_menu |