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 5 times in this file.
Line | Code |
---|---|
338 | $class = esc_attr( $class ); |
339 | $id = $id ? esc_attr( $id ) : $name; |
340 |
|
341 | if ( ! $r['hide_if_empty'] || ! empty($categories) ) |
342 | $output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n"; |
343 | else |
344 | $output = ''; |
345 |
|
346 | if ( empty($categories) && ! $r['hide_if_empty'] && !empty($show_option_none) ) { |
347 | $show_option_none = apply_filters( 'list_cats', $show_option_none ); |
348 | $output .= "\t<option value='-1' selected='selected'>$show_option_none</option>\n"; |
349 | } |
350 |
|
351 | if ( ! empty( $categories ) ) { |
352 |
|
353 | if ( $show_option_all ) { |
354 | $show_option_all = apply_filters( 'list_cats', $show_option_all ); |
355 | $selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : ''; |
356 | $output .= "\t<option value='0'$selected>$show_option_all</option>\n"; |
357 | } |
358 |
|
359 | if ( $show_option_none ) { |
360 | $show_option_none = apply_filters( 'list_cats', $show_option_none ); |
361 | $selected = ( '-1' === strval($r['selected']) ) ? " selected='selected'" : ''; |
362 | $output .= "\t<option value='-1'$selected>$show_option_none</option>\n"; |
363 | } |
364 |
|
365 | if ( $hierarchical ) |
366 | $depth = $r['depth']; // Walk the full depth. |
367 | else |
368 | $depth = -1; // Flat. |
369 |
|
Line | Code |
828 | * @param string $output Passed by reference. Used to append additional content. |
829 | * @param object $category Category data object. |
830 | * @param int $depth Depth of category in reference to parents. |
831 | * @param array $args |
832 | */ |
833 | function start_el(&$output, $category, $depth, $args) { |
834 | extract($args); |
835 |
|
836 | $cat_name = esc_attr( $category->name ); |
837 | $cat_name = apply_filters( 'list_cats', $cat_name, $category ); |
838 | $link = '<a href="' . esc_attr( get_term_link($category) ) . '" '; |
839 | if ( $use_desc_for_title == 0 || empty($category->description) ) |
840 | $link .= 'title="' . esc_attr( sprintf(__( 'View all posts filed under %s' ), $cat_name) ) . '"'; |
841 | else |
842 | $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"'; |
843 | $link .= '>'; |
844 | $link .= $cat_name . '</a>'; |
845 |
|
846 | if ( !empty($feed_image) || !empty($feed) ) { |
Line | Code |
943 | * |
944 | * @param string $output Passed by reference. Used to append additional content. |
945 | * @param object $category Category data object. |
946 | * @param int $depth Depth of category. Used for padding. |
947 | * @param array $args Uses 'selected', 'show_count', and 'show_last_update' keys, if they exist. |
948 | */ |
949 | function start_el(&$output, $category, $depth, $args) { |
950 | $pad = str_repeat(' ', $depth * 3); |
951 |
|
952 | $cat_name = apply_filters('list_cats', $category->name, $category); |
953 | $output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\""; |
954 | if ( $category->term_id == $args['selected'] ) |
955 | $output .= ' selected="selected"'; |
956 | $output .= '>'; |
957 | $output .= $pad.$cat_name; |
958 | if ( $args['show_count'] ) |
959 | $output .= ' ('. $category->count .')'; |
960 | if ( $args['show_last_update'] ) { |
961 | $format = 'Y-m-d'; |