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 | ?> |
289 | <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> |
Line | Code |
369 |
|
370 | public function __construct() { |
371 | $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, & WordPress.org links.") ); |
372 | parent::__construct('meta', __('Meta'), $widget_ops); |
373 | } |
374 |
|
375 | public function widget( $args, $instance ) { |
376 |
|
377 | /** This filter is documented in wp-includes/default-widgets.php */ |
378 | $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base ); |
379 |
|
380 | echo $args['before_widget']; |
381 | if ( $title ) { |
382 | echo $args['before_title'] . $title . $args['after_title']; |
383 | } |
384 | ?> |
385 | <ul> |
386 | <?php wp_register(); ?> |
387 | <li><?php wp_loginout(); ?></li> |
Line | Code |
433 |
|
434 | public function __construct() { |
435 | $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s Posts.') ); |
436 | parent::__construct('calendar', __('Calendar'), $widget_ops); |
437 | } |
438 |
|
439 | public function widget( $args, $instance ) { |
440 |
|
441 | /** This filter is documented in wp-includes/default-widgets.php */ |
442 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
443 |
|
444 | echo $args['before_widget']; |
445 | if ( $title ) { |
446 | echo $args['before_title'] . $title . $args['after_title']; |
447 | } |
448 | echo '<div id="calendar_wrap">'; |
449 | get_calendar(); |
450 | echo '</div>'; |
451 | echo $args['after_widget']; |
Line | Code |
478 | public function __construct() { |
479 | $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML.')); |
480 | $control_ops = array('width' => 400, 'height' => 350); |
481 | parent::__construct('text', __('Text'), $widget_ops, $control_ops); |
482 | } |
483 |
|
484 | public function widget( $args, $instance ) { |
485 |
|
486 | /** This filter is documented in wp-includes/default-widgets.php */ |
487 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
488 |
|
489 | /** |
490 | * Filter the content of the Text widget. |
491 | * |
492 | * @since 2.3.0 |
493 | * |
494 | * @param string $widget_text The widget content. |
495 | * @param WP_Widget $instance WP_Widget instance. |
496 | */ |
Line | Code |
539 |
|
540 | public 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 | public function widget( $args, $instance ) { |
546 |
|
547 | /** This filter is documented in wp-includes/default-widgets.php */ |
548 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base ); |
549 |
|
550 | $c = ! empty( $instance['count'] ) ? '1' : '0'; |
551 | $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; |
552 | $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; |
553 |
|
554 | echo $args['before_widget']; |
555 | if ( $title ) { |
556 | echo $args['before_title'] . $title . $args['after_title']; |
557 | } |
Line | Code |
677 | echo $cache[ $args['widget_id'] ]; |
678 | return; |
679 | } |
680 |
|
681 | ob_start(); |
682 |
|
683 | $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' ); |
684 |
|
685 | /** This filter is documented in wp-includes/default-widgets.php */ |
686 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
687 |
|
688 | $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; |
689 | if ( ! $number ) |
690 | $number = 5; |
691 | $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; |
692 |
|
693 | /** |
694 | * Filter the arguments for the Recent Posts widget. |
695 | * |
Line | Code |
832 | echo $cache[ $args['widget_id'] ]; |
833 | return; |
834 | } |
835 |
|
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 |
958 | $link = esc_url(strip_tags($rss->get_permalink())); |
959 | while ( stristr($link, 'http') != $link ) |
960 | $link = substr($link, 1); |
961 | } |
962 |
|
963 | if ( empty($title) ) |
964 | $title = empty($desc) ? __('Unknown Feed') : $desc; |
965 |
|
966 | /** This filter is documented in wp-includes/default-widgets.php */ |
967 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
968 |
|
969 | $url = esc_url(strip_tags($url)); |
970 | $icon = includes_url('images/rss.png'); |
971 | if ( $title ) |
972 | $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>"; |
973 |
|
974 | echo $args['before_widget']; |
975 | if ( $title ) { |
976 | echo $args['before_title'] . $title . $args['after_title']; |
Line | Code |
1233 | if ( 'post_tag' == $current_taxonomy ) { |
1234 | $title = __('Tags'); |
1235 | } else { |
1236 | $tax = get_taxonomy($current_taxonomy); |
1237 | $title = $tax->labels->name; |
1238 | } |
1239 | } |
1240 |
|
1241 | /** This filter is documented in wp-includes/default-widgets.php */ |
1242 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
1243 |
|
1244 | echo $args['before_widget']; |
1245 | if ( $title ) { |
1246 | echo $args['before_title'] . $title . $args['after_title']; |
1247 | } |
1248 | echo '<div class="tagcloud">'; |
1249 |
|
1250 | /** |
1251 | * Filter the taxonomy used in the Tag Cloud widget. |
Line | Code |
1310 |
|
1311 | public function widget($args, $instance) { |
1312 | // Get menu |
1313 | $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false; |
1314 |
|
1315 | if ( !$nav_menu ) |
1316 | return; |
1317 |
|
1318 | /** This filter is documented in wp-includes/default-widgets.php */ |
1319 | $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
1320 |
|
1321 | echo $args['before_widget']; |
1322 |
|
1323 | if ( !empty($instance['title']) ) |
1324 | echo $args['before_title'] . $instance['title'] . $args['after_title']; |
1325 |
|
1326 | wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu ) ); |
1327 |
|
1328 | echo $args['after_widget']; |