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', $show_option_none ); |
384 | $output .= "\t<option value='-1' selected='selected'>$show_option_none</option>\n"; |
385 | } |
386 |
|
387 | if ( ! empty( $categories ) ) { |
388 |
|
389 | if ( $show_option_all ) { |
390 |
|
391 | /** This filter is documented in wp-includes/category-template.php */ |
392 | $show_option_all = apply_filters( 'list_cats', $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 ( $show_option_none ) { |
398 |
|
399 | /** This filter is documented in wp-includes/category-template.php */ |
400 | $show_option_none = apply_filters( 'list_cats', $show_option_none ); |
401 | $selected = ( '-1' === strval($r['selected']) ) ? " selected='selected'" : ''; |
402 | $output .= "\t<option value='-1'$selected>$show_option_none</option>\n"; |
403 | } |
404 |
|
405 | if ( $hierarchical ) |
406 | $depth = $r['depth']; // Walk the full depth. |
407 | else |
408 | $depth = -1; // Flat. |
409 |
|
Line | Code |
956 | * @param array $args An array of arguments. @see wp_list_categories() |
957 | * @param int $id ID of the current category. |
958 | */ |
959 | function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { |
960 | extract($args); |
961 |
|
962 | $cat_name = esc_attr( $category->name ); |
963 |
|
964 | /** This filter is documented in wp-includes/category-template.php */ |
965 | $cat_name = apply_filters( 'list_cats', $cat_name, $category ); |
966 |
|
967 | $link = '<a href="' . esc_url( get_term_link($category) ) . '" '; |
968 | if ( $use_desc_for_title == 0 || empty($category->description) ) { |
969 | $link .= 'title="' . esc_attr( sprintf(__( 'View all posts filed under %s' ), $cat_name) ) . '"'; |
970 | } else { |
971 | /** |
972 | * Filter the category description for display. |
973 | * |
974 | * @since 1.2.0 |
Line | Code |
1085 | * @param string $output Passed by reference. Used to append additional content. |
1086 | * @param object $category Category data object. |
1087 | * @param int $depth Depth of category. Used for padding. |
1088 | * @param array $args Uses 'selected' and 'show_count' keys, if they exist. @see wp_dropdown_categories() |
1089 | */ |
1090 | function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { |
1091 | $pad = str_repeat(' ', $depth * 3); |
1092 |
|
1093 | /** This filter is documented in wp-includes/category-template.php */ |
1094 | $cat_name = apply_filters( 'list_cats', $category->name, $category ); |
1095 |
|
1096 | $output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\""; |
1097 | if ( $category->term_id == $args['selected'] ) |
1098 | $output .= ' selected="selected"'; |
1099 | $output .= '>'; |
1100 | $output .= $pad.$cat_name; |
1101 | if ( $args['show_count'] ) |
1102 | $output .= ' ('. number_format_i18n( $category->count ) .')'; |
1103 | $output .= "</option>\n"; |