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 11 times in this file.
Line | Code |
---|---|
16 |
|
17 | function WP_Widget_Pages() { |
18 | $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'Your site’s WordPress Pages') ); |
19 | $this->WP_Widget('pages', __('Pages'), $widget_ops); |
20 | } |
21 |
|
22 | function widget( $args, $instance ) { |
23 | extract( $args ); |
24 |
|
25 | $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base); |
26 | $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; |
27 | $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; |
28 |
|
29 | if ( $sortby == 'menu_order' ) |
30 | $sortby = 'menu_order, post_title'; |
31 |
|
32 | $out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) ); |
33 |
|
34 | if ( !empty( $out ) ) { |
Line | Code |
172 | class WP_Widget_Search extends WP_Widget { |
173 |
|
174 | function WP_Widget_Search() { |
175 | $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site") ); |
176 | $this->WP_Widget('search', __('Search'), $widget_ops); |
177 | } |
178 |
|
179 | function widget( $args, $instance ) { |
180 | extract($args); |
181 | $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); |
182 |
|
183 | echo $before_widget; |
184 | if ( $title ) |
185 | echo $before_title . $title . $after_title; |
186 |
|
187 | // Use current theme search form if it exists |
188 | get_search_form(); |
189 |
|
190 | echo $after_widget; |
Line | Code |
217 | function WP_Widget_Archives() { |
218 | $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site’s posts') ); |
219 | $this->WP_Widget('archives', __('Archives'), $widget_ops); |
220 | } |
221 |
|
222 | function widget( $args, $instance ) { |
223 | extract($args); |
224 | $c = $instance['count'] ? '1' : '0'; |
225 | $d = $instance['dropdown'] ? '1' : '0'; |
226 | $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $instance, $this->id_base); |
227 |
|
228 | echo $before_widget; |
229 | if ( $title ) |
230 | echo $before_title . $title . $after_title; |
231 |
|
232 | if ( $d ) { |
233 | ?> |
234 | <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo esc_attr(__('Select Month')); ?></option> <?php wp_get_archives(apply_filters('widget_archives_dropdown_args', array('type' => 'monthly', 'format' => 'option', 'show_post_count' => $c))); ?> </select> |
235 | <?php |
Line | Code |
280 | class WP_Widget_Meta extends WP_Widget { |
281 |
|
282 | function WP_Widget_Meta() { |
283 | $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") ); |
284 | $this->WP_Widget('meta', __('Meta'), $widget_ops); |
285 | } |
286 |
|
287 | function widget( $args, $instance ) { |
288 | extract($args); |
289 | $title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title'], $instance, $this->id_base); |
290 |
|
291 | echo $before_widget; |
292 | if ( $title ) |
293 | echo $before_title . $title . $after_title; |
294 | ?> |
295 | <ul> |
296 | <?php wp_register(); ?> |
297 | <li><?php wp_loginout(); ?></li> |
298 | <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 |
328 | class WP_Widget_Calendar extends WP_Widget { |
329 |
|
330 | function WP_Widget_Calendar() { |
331 | $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s posts') ); |
332 | $this->WP_Widget('calendar', __('Calendar'), $widget_ops); |
333 | } |
334 |
|
335 | function widget( $args, $instance ) { |
336 | extract($args); |
337 | $title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title'], $instance, $this->id_base); |
338 | echo $before_widget; |
339 | if ( $title ) |
340 | echo $before_title . $title . $after_title; |
341 | echo '<div id="calendar_wrap">'; |
342 | get_calendar(); |
343 | echo '</div>'; |
344 | echo $after_widget; |
345 | } |
346 |
|
Line | Code |
370 |
|
371 | function WP_Widget_Text() { |
372 | $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML')); |
373 | $control_ops = array('width' => 400, 'height' => 350); |
374 | $this->WP_Widget('text', __('Text'), $widget_ops, $control_ops); |
375 | } |
376 |
|
377 | function widget( $args, $instance ) { |
378 | extract($args); |
379 | $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); |
380 | $text = apply_filters( 'widget_text', $instance['text'], $instance ); |
381 | echo $before_widget; |
382 | if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?> |
383 | <div class="textwidget"><?php echo $instance['filter'] ? wpautop($text) : $text; ?></div> |
384 | <?php |
385 | echo $after_widget; |
386 | } |
387 |
|
388 | function update( $new_instance, $old_instance ) { |
Line | Code |
420 |
|
421 | function WP_Widget_Categories() { |
422 | $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories" ) ); |
423 | $this->WP_Widget('categories', __('Categories'), $widget_ops); |
424 | } |
425 |
|
426 | function widget( $args, $instance ) { |
427 | extract( $args ); |
428 |
|
429 | $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base); |
430 | $c = $instance['count'] ? '1' : '0'; |
431 | $h = $instance['hierarchical'] ? '1' : '0'; |
432 | $d = $instance['dropdown'] ? '1' : '0'; |
433 |
|
434 | echo $before_widget; |
435 | if ( $title ) |
436 | echo $before_title . $title . $after_title; |
437 |
|
438 | $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); |
Line | Code |
528 |
|
529 | if ( isset($cache[$args['widget_id']]) ) { |
530 | echo $cache[$args['widget_id']]; |
531 | return; |
532 | } |
533 |
|
534 | ob_start(); |
535 | extract($args); |
536 |
|
537 | $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base); |
538 | if ( !$number = (int) $instance['number'] ) |
539 | $number = 10; |
540 | else if ( $number < 1 ) |
541 | $number = 1; |
542 | else if ( $number > 15 ) |
543 | $number = 15; |
544 |
|
545 | $r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1)); |
546 | if ($r->have_posts()) : |
Line | Code |
631 | $cache = array(); |
632 |
|
633 | if ( isset( $cache[$args['widget_id']] ) ) { |
634 | echo $cache[$args['widget_id']]; |
635 | return; |
636 | } |
637 |
|
638 | extract($args, EXTR_SKIP); |
639 | $output = ''; |
640 | $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title']); |
641 |
|
642 | if ( ! $number = (int) $instance['number'] ) |
643 | $number = 5; |
644 | else if ( $number < 1 ) |
645 | $number = 1; |
646 |
|
647 | $comments = get_comments( array( 'number' => $number, 'status' => 'approve' ) ); |
648 | $output .= $before_widget; |
649 | if ( $title ) |
Line | Code |
727 | $title = esc_html(strip_tags($rss->get_title())); |
728 | $link = esc_url(strip_tags($rss->get_permalink())); |
729 | while ( stristr($link, 'http') != $link ) |
730 | $link = substr($link, 1); |
731 | } |
732 |
|
733 | if ( empty($title) ) |
734 | $title = empty($desc) ? __('Unknown Feed') : $desc; |
735 |
|
736 | $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
737 | $url = esc_url(strip_tags($url)); |
738 | $icon = includes_url('images/rss.png'); |
739 | if ( $title ) |
740 | $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>"; |
741 |
|
742 | echo $before_widget; |
743 | if ( $title ) |
744 | echo $before_title . $title . $after_title; |
745 | wp_widget_rss_output( $rss, $instance ); |
Line | Code |
1000 | $title = $instance['title']; |
1001 | } else { |
1002 | if ( 'post_tag' == $current_taxonomy ) { |
1003 | $title = __('Tags'); |
1004 | } else { |
1005 | $tax = get_taxonomy($current_taxonomy); |
1006 | $title = $tax->labels->name; |
1007 | } |
1008 | } |
1009 | $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
1010 |
|
1011 | echo $before_widget; |
1012 | if ( $title ) |
1013 | echo $before_title . $title . $after_title; |
1014 | echo '<div>'; |
1015 | wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy) ) ); |
1016 | echo "</div>\n"; |
1017 | echo $after_widget; |
1018 | } |