Changeset 27666
- Timestamp:
- 03/24/2014 01:34:46 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/category-template.php
r27521 r27666 83 83 } 84 84 85 // Filter name is plural because we return alot of categories (possibly more than #13237) not just one 85 /** 86 * Filter the array of categories to return for a post. 87 * 88 * @since 3.1.0 89 * 90 * @param array $categories An array of categories to return for the post. 91 */ 86 92 return apply_filters( 'get_the_categories', $categories ); 87 93 } … … 156 162 function get_the_category_list( $separator = '', $parents='', $post_id = false ) { 157 163 global $wp_rewrite; 158 if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) 164 if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) { 165 /** This filter is documented in wp-includes/category-template.php */ 159 166 return apply_filters( 'the_category', '', $separator, $parents ); 167 } 160 168 161 169 $categories = get_the_category( $post_id ); 162 if ( empty( $categories ) ) 170 if ( empty( $categories ) ) { 171 /** This filter is documented in wp-includes/category-template.php */ 163 172 return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents ); 173 } 164 174 165 175 $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"'; … … 212 222 } 213 223 } 224 225 /** 226 * Filter the category or list of categories. 227 * 228 * @since 1.2.0 229 * 230 * @param array $thelist List of categories for the current post. 231 * @param string $separator Separator used between the categories. 232 * @param string $parents How to display the category parents. Accepts 'multiple', 233 * 'single', or empty. 234 */ 214 235 return apply_filters( 'the_category', $thelist, $separator, $parents ); 215 236 } … … 345 366 346 367 if ( empty($categories) && ! $r['hide_if_empty'] && !empty($show_option_none) ) { 368 369 /** 370 * Filter a taxonomy drop-down display element. 371 * 372 * A variety of taxonomy drop-down display elements can be modified 373 * just prior to display via this filter. Filterable arguments include 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 */ 347 383 $show_option_none = apply_filters( 'list_cats', $show_option_none ); 348 384 $output .= "\t<option value='-1' selected='selected'>$show_option_none</option>\n"; … … 352 388 353 389 if ( $show_option_all ) { 390 391 /** This filter is documented in wp-includes/category-template.php */ 354 392 $show_option_all = apply_filters( 'list_cats', $show_option_all ); 355 393 $selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : ''; … … 358 396 359 397 if ( $show_option_none ) { 398 399 /** This filter is documented in wp-includes/category-template.php */ 360 400 $show_option_none = apply_filters( 'list_cats', $show_option_none ); 361 401 $selected = ( '-1' === strval($r['selected']) ) ? " selected='selected'" : ''; … … 375 415 376 416 /** 377 * Filter the result of wp_dropdown_categories().417 * Filter the taxonomy drop-down output. 378 418 * 379 419 * @since 2.1.0 380 420 * 381 * @param $output HTML content.382 * @param $r Arguments used to build the dropdown.421 * @param string $output HTML output. 422 * @param array $r Arguments used to build the drop-down. 383 423 */ 384 424 $output = apply_filters( 'wp_dropdown_cats', $output, $r ); … … 494 534 $output .= '</ul></li>'; 495 535 536 /** 537 * Filter the HTML output of a taxonomy list. 538 * 539 * @since 2.1.0 540 * 541 * @param string $output HTML output. 542 * @param array $args An array of taxonomy-listing arguments. 543 */ 496 544 $output = apply_filters( 'wp_list_categories', $output, $args ); 497 545 … … 560 608 $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args 561 609 610 /** 611 * Filter the tag cloud output. 612 * 613 * @since 2.3.0 614 * 615 * @param string $return HTML output of the tag cloud. 616 * @param array $args An array of tag cloud arguments. 617 */ 562 618 $return = apply_filters( 'wp_tag_cloud', $return, $args ); 563 619 … … 645 701 } 646 702 703 /** 704 * Filter how the items in a tag cloud are sorted. 705 * 706 * @since 2.8.0 707 * 708 * @param array $tags Ordered array of terms. 709 * @param array $args An array of tag cloud arguments. 710 */ 647 711 $tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args ); 648 if ( $tags_sorted != $tags ) { // the tags have been sorted by a plugin712 if ( $tags_sorted != $tags ) { 649 713 $tags = $tags_sorted; 650 714 unset($tags_sorted); … … 717 781 endswitch; 718 782 719 if ( $filter ) 783 if ( $filter ) { 784 /** 785 * Filter the generated output of a tag cloud. 786 * 787 * The filter is only evaluated if a true value is passed 788 * to the $filter argument in wp_generate_tag_cloud(). 789 * 790 * @since 2.3.0 791 * 792 * @see wp_generate_tag_cloud() 793 * 794 * @param string $return Generated HTML output of the tag cloud. 795 * @param array $tags An array of terms used in the tag cloud. 796 * @param array $args An array of wp_generate_tag_cloud() arguments. 797 */ 720 798 return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args ); 799 } 800 721 801 else 722 802 return $return; … … 867 947 868 948 $cat_name = esc_attr( $category->name ); 949 950 /** This filter is documented in wp-includes/category-template.php */ 869 951 $cat_name = apply_filters( 'list_cats', $cat_name, $category ); 952 870 953 $link = '<a href="' . esc_url( get_term_link($category) ) . '" '; 871 if ( $use_desc_for_title == 0 || empty($category->description) ) 954 if ( $use_desc_for_title == 0 || empty($category->description) ) { 872 955 $link .= 'title="' . esc_attr( sprintf(__( 'View all posts filed under %s' ), $cat_name) ) . '"'; 873 else 956 } else { 957 /** 958 * Filter the category description for display. 959 * 960 * @since 1.2.0 961 * 962 * @param string $description Category description. 963 * @param object $category Category object. 964 */ 874 965 $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"'; 966 } 967 875 968 $link .= '>'; 876 969 $link .= $cat_name . '</a>'; … … 984 1077 $pad = str_repeat(' ', $depth * 3); 985 1078 986 $cat_name = apply_filters('list_cats', $category->name, $category); 1079 /** This filter is documented in wp-includes/category-template.php */ 1080 $cat_name = apply_filters( 'list_cats', $category->name, $category ); 1081 987 1082 $output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\""; 988 1083 if ( $category->term_id == $args['selected'] ) … … 1025 1120 * 1026 1121 * @since 2.3.0 1027 * @uses apply_filters() Calls 'get_the_tags' filter on the list of post tags.1028 1122 * 1029 1123 * @param int $id Post ID. … … 1031 1125 */ 1032 1126 function get_the_tags( $id = 0 ) { 1127 1128 /** 1129 * Filter the array of tags for the given post. 1130 * 1131 * @since 2.3.0 1132 * 1133 * @see get_the_terms() 1134 * 1135 * @param array $terms An array of tags for the given post. 1136 */ 1033 1137 return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ) ); 1034 1138 } … … 1038 1142 * 1039 1143 * @since 2.3.0 1040 * @uses apply_filters() Calls 'the_tags' filter on string list of tags.1041 1144 * 1042 1145 * @param string $before Optional. Before tags. … … 1047 1150 */ 1048 1151 function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) { 1152 1153 /** 1154 * Filter the tags list for a given post. 1155 * 1156 * @since 2.3.0 1157 * 1158 * @param string $tag_list List of tags. 1159 * @param string $before String to use before tags. 1160 * @param string $sep String to use between the tags. 1161 * @param string $after String to use after tags. 1162 * @param int $id Post ID. 1163 */ 1049 1164 return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id ); 1050 1165 } … … 1117 1232 } 1118 1233 1234 /** 1235 * Filter the list of terms attached to the given post. 1236 * 1237 * @since 3.1.0 1238 * 1239 * @param array $terms List of attached terms. 1240 * @param int $post_id Post ID. 1241 * @param string $taxonomy Name of the taxonomy. 1242 */ 1119 1243 $terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy ); 1120 1244 … … 1153 1277 } 1154 1278 1279 /** 1280 * Filter the term links for a given taxonomy. 1281 * 1282 * The dynamic portion of the filter name, $taxonomy, refers 1283 * to the taxonomy slug. 1284 * 1285 * @since 2.5.0 1286 * 1287 * @param array $term_links An array of term links. 1288 */ 1155 1289 $term_links = apply_filters( "term_links-$taxonomy", $term_links ); 1156 1290 … … 1176 1310 return false; 1177 1311 1178 echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after); 1312 /** 1313 * Filter the list of terms to display. 1314 * 1315 * @since 2.9.0 1316 * 1317 * @param array $term_list List of terms to display. 1318 * @param string $taxonomy The taxonomy name. 1319 * @param string $before String to use before the terms. 1320 * @param string $sep String to use between the terms. 1321 * @param string $after String to use after the terms. 1322 */ 1323 echo apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after ); 1179 1324 } 1180 1325
Note: See TracChangeset
for help on using the changeset viewer.