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 |
|---|---|
| 24 | /** |
| 25 | * Filter the widget title. |
| 26 | * |
| 27 | * @since 2.6.0 |
| 28 | * |
| 29 | * @param string $title The widget title. Default 'Pages'. |
| 30 | * @param array $instance An array of the widget's settings. |
| 31 | * @param mixed $id_base The widget ID. |
| 32 | */ |
| 33 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base ); |
| 34 | |
| 35 | $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; |
| 36 | $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; |
| 37 | |
| 38 | if ( $sortby == 'menu_order' ) |
| 39 | $sortby = 'menu_order, post_title'; |
| 40 | |
| 41 | /** |
| 42 | * Filter the arguments for the Pages widget. |
| Line | Code |
| 226 | function __construct() { |
| 227 | $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site.") ); |
| 228 | parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops ); |
| 229 | } |
| 230 | |
| 231 | function widget( $args, $instance ) { |
| 232 | extract($args); |
| 233 | |
| 234 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 235 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 236 | |
| 237 | echo $before_widget; |
| 238 | if ( $title ) |
| 239 | echo $before_title . $title . $after_title; |
| 240 | |
| 241 | // Use current theme search form if it exists |
| 242 | get_search_form(); |
| 243 | |
| 244 | echo $after_widget; |
| Line | Code |
| 273 | parent::__construct('archives', __('Archives'), $widget_ops); |
| 274 | } |
| 275 | |
| 276 | function widget( $args, $instance ) { |
| 277 | extract($args); |
| 278 | $c = ! empty( $instance['count'] ) ? '1' : '0'; |
| 279 | $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; |
| 280 | |
| 281 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 282 | $title = apply_filters( 'widget_title', empty($instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base ); |
| 283 | |
| 284 | echo $before_widget; |
| 285 | if ( $title ) |
| 286 | echo $before_title . $title . $after_title; |
| 287 | |
| 288 | if ( $d ) { |
| 289 | ?> |
| 290 | <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> |
| 291 | <option value=""><?php echo esc_attr( __( 'Select Month' ) ); ?></option> |
| Line | Code |
| 371 | function __construct() { |
| 372 | $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, & WordPress.org links.") ); |
| 373 | parent::__construct('meta', __('Meta'), $widget_ops); |
| 374 | } |
| 375 | |
| 376 | function widget( $args, $instance ) { |
| 377 | extract($args); |
| 378 | |
| 379 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 380 | $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base ); |
| 381 | |
| 382 | echo $before_widget; |
| 383 | if ( $title ) |
| 384 | echo $before_title . $title . $after_title; |
| 385 | ?> |
| 386 | <ul> |
| 387 | <?php wp_register(); ?> |
| 388 | <li><?php wp_loginout(); ?></li> |
| 389 | <li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo esc_attr(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> |
| Line | Code |
| 435 | function __construct() { |
| 436 | $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s Posts.') ); |
| 437 | parent::__construct('calendar', __('Calendar'), $widget_ops); |
| 438 | } |
| 439 | |
| 440 | function widget( $args, $instance ) { |
| 441 | extract($args); |
| 442 | |
| 443 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 444 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 445 | |
| 446 | echo $before_widget; |
| 447 | if ( $title ) |
| 448 | echo $before_title . $title . $after_title; |
| 449 | echo '<div id="calendar_wrap">'; |
| 450 | get_calendar(); |
| 451 | echo '</div>'; |
| 452 | echo $after_widget; |
| 453 | } |
| Line | Code |
| 480 | $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML.')); |
| 481 | $control_ops = array('width' => 400, 'height' => 350); |
| 482 | parent::__construct('text', __('Text'), $widget_ops, $control_ops); |
| 483 | } |
| 484 | |
| 485 | function widget( $args, $instance ) { |
| 486 | extract($args); |
| 487 | |
| 488 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 489 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 490 | |
| 491 | /** |
| 492 | * Filter the content of the Text widget. |
| 493 | * |
| 494 | * @since 2.3.0 |
| 495 | * |
| 496 | * @param string $widget_text The widget content. |
| 497 | * @param WP_Widget $instance WP_Widget instance. |
| 498 | */ |
| Line | Code |
| 540 | function __construct() { |
| 541 | $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories." ) ); |
| 542 | parent::__construct('categories', __('Categories'), $widget_ops); |
| 543 | } |
| 544 | |
| 545 | function widget( $args, $instance ) { |
| 546 | extract( $args ); |
| 547 | |
| 548 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 549 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base ); |
| 550 | |
| 551 | $c = ! empty( $instance['count'] ) ? '1' : '0'; |
| 552 | $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; |
| 553 | $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; |
| 554 | |
| 555 | echo $before_widget; |
| 556 | if ( $title ) |
| 557 | echo $before_title . $title . $after_title; |
| 558 | |
| Line | Code |
| 678 | return; |
| 679 | } |
| 680 | |
| 681 | ob_start(); |
| 682 | extract($args); |
| 683 | |
| 684 | $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' ); |
| 685 | |
| 686 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 687 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 688 | |
| 689 | $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; |
| 690 | if ( ! $number ) |
| 691 | $number = 5; |
| 692 | $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; |
| 693 | |
| 694 | /** |
| 695 | * Filter the arguments for the Recent Posts widget. |
| 696 | * |
| Line | Code |
| 832 | return; |
| 833 | } |
| 834 | |
| 835 | extract($args, EXTR_SKIP); |
| 836 | $output = ''; |
| 837 | |
| 838 | $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' ); |
| 839 | |
| 840 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 841 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 842 | |
| 843 | $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; |
| 844 | if ( ! $number ) |
| 845 | $number = 5; |
| 846 | |
| 847 | /** |
| 848 | * Filter the arguments for the Recent Comments widget. |
| 849 | * |
| 850 | * @since 3.4.0 |
| Line | Code |
| 953 | $link = esc_url(strip_tags($rss->get_permalink())); |
| 954 | while ( stristr($link, 'http') != $link ) |
| 955 | $link = substr($link, 1); |
| 956 | } |
| 957 | |
| 958 | if ( empty($title) ) |
| 959 | $title = empty($desc) ? __('Unknown Feed') : $desc; |
| 960 | |
| 961 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 962 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 963 | |
| 964 | $url = esc_url(strip_tags($url)); |
| 965 | $icon = includes_url('images/rss.png'); |
| 966 | if ( $title ) |
| 967 | $title = "<a class='rsswidget' href='$url' title='" . esc_attr__( 'Syndicate this content' ) ."'><img style='border:0' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>"; |
| 968 | |
| 969 | echo $before_widget; |
| 970 | if ( $title ) |
| 971 | echo $before_title . $title . $after_title; |
| Line | Code |
| 1228 | if ( 'post_tag' == $current_taxonomy ) { |
| 1229 | $title = __('Tags'); |
| 1230 | } else { |
| 1231 | $tax = get_taxonomy($current_taxonomy); |
| 1232 | $title = $tax->labels->name; |
| 1233 | } |
| 1234 | } |
| 1235 | |
| 1236 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 1237 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
| 1238 | |
| 1239 | echo $before_widget; |
| 1240 | if ( $title ) |
| 1241 | echo $before_title . $title . $after_title; |
| 1242 | echo '<div class="tagcloud">'; |
| 1243 | |
| 1244 | /** |
| 1245 | * Filter the taxonomy used in the Tag Cloud widget. |
| 1246 | * |
| Line | Code |
| 1304 | |
| 1305 | function widget($args, $instance) { |
| 1306 | // Get menu |
| 1307 | $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false; |
| 1308 | |
| 1309 | if ( !$nav_menu ) |
| 1310 | return; |
| 1311 | |
| 1312 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 1313 | $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
| 1314 | |
| 1315 | echo $args['before_widget']; |
| 1316 | |
| 1317 | if ( !empty($instance['title']) ) |
| 1318 | echo $args['before_title'] . $instance['title'] . $args['after_title']; |
| 1319 | |
| 1320 | wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu ) ); |
| 1321 | |
| 1322 | echo $args['after_widget']; |