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 |
|---|---|
| 374 | * 'show_option_none', 'show_option_all', and various forms of the |
| 375 | * term name. |
| 376 | * |
| 377 | * @since 1.2.0 |
| 378 | * |
| 379 | * @see wp_dropdown_categories() |
| 380 | * |
| 381 | * @param string $element Taxonomy element to list. |
| 382 | */ |
| 383 | $show_option_none = apply_filters( 'list_cats', $r['show_option_none'] ); |
| 384 | $output .= "\t<option value='" . esc_attr( $option_none_value ) . "' selected='selected'>$show_option_none</option>\n"; |
| 385 | } |
| 386 | |
| 387 | if ( ! empty( $categories ) ) { |
| 388 | |
| 389 | if ( $r['show_option_all'] ) { |
| 390 | |
| 391 | /** This filter is documented in wp-includes/category-template.php */ |
| 392 | $show_option_all = apply_filters( 'list_cats', $r['show_option_all'] ); |
| 393 | $selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : ''; |
| 394 | $output .= "\t<option value='0'$selected>$show_option_all</option>\n"; |
| 395 | } |
| 396 | |
| 397 | if ( $r['show_option_none'] ) { |
| 398 | |
| 399 | /** This filter is documented in wp-includes/category-template.php */ |
| 400 | $show_option_none = apply_filters( 'list_cats', $r['show_option_none'] ); |
| 401 | $selected = selected( $option_none_value, $r['selected'], false ); |
| 402 | $output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$selected>$show_option_none</option>\n"; |
| 403 | } |
| 404 | |
| 405 | if ( $r['hierarchical'] ) { |
| 406 | $depth = $r['depth']; // Walk the full depth. |
| 407 | } else { |
| 408 | $depth = -1; // Flat. |
| 409 | } |
| Line | Code |
| 957 | * |
| 958 | * @param string $output Passed by reference. Used to append additional content. |
| 959 | * @param object $category Category data object. |
| 960 | * @param int $depth Depth of category in reference to parents. Default 0. |
| 961 | * @param array $args An array of arguments. @see wp_list_categories() |
| 962 | * @param int $id ID of the current category. |
| 963 | */ |
| 964 | public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { |
| 965 | /** This filter is documented in wp-includes/category-template.php */ |
| 966 | $cat_name = apply_filters( |
| 967 | 'list_cats', |
| 968 | esc_attr( $category->name ), |
| 969 | $category |
| 970 | ); |
| 971 | |
| 972 | $link = '<a href="' . esc_url( get_term_link( $category ) ) . '" '; |
| 973 | if ( $args['use_desc_for_title'] && ! empty( $category->description ) ) { |
| 974 | /** |
| 975 | * Filter the category description for display. |
| Line | Code |
| 1090 | * @param string $output Passed by reference. Used to append additional content. |
| 1091 | * @param object $category Category data object. |
| 1092 | * @param int $depth Depth of category. Used for padding. |
| 1093 | * @param array $args Uses 'selected' and 'show_count' keys, if they exist. @see wp_dropdown_categories() |
| 1094 | */ |
| 1095 | public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { |
| 1096 | $pad = str_repeat(' ', $depth * 3); |
| 1097 | |
| 1098 | /** This filter is documented in wp-includes/category-template.php */ |
| 1099 | $cat_name = apply_filters( 'list_cats', $category->name, $category ); |
| 1100 | |
| 1101 | $output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\""; |
| 1102 | if ( $category->term_id == $args['selected'] ) |
| 1103 | $output .= ' selected="selected"'; |
| 1104 | $output .= '>'; |
| 1105 | $output .= $pad.$cat_name; |
| 1106 | if ( $args['show_count'] ) |
| 1107 | $output .= ' ('. number_format_i18n( $category->count ) .')'; |
| 1108 | $output .= "</option>\n"; |