Changeset 27676
- Timestamp:
- 03/24/2014 03:36:36 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-template.php
r27622 r27676 108 108 if ( ! is_admin() ) { 109 109 if ( ! empty( $post->post_password ) ) { 110 111 /** 112 * Filter the text prepended to the post title for protected posts. 113 * 114 * The filter is only applied on the front end. 115 * 116 * @since 2.8.0 117 * 118 * @param string $prepend Text displayed before the post title. 119 * Default 'Protected: %s'. 120 */ 110 121 $protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ) ); 111 122 $title = sprintf( $protected_title_format, $title ); 112 123 } else if ( isset( $post->post_status ) && 'private' == $post->post_status ) { 124 125 /** 126 * Filter the text prepended to the post title of private posts. 127 * 128 * The filter is only applied on the front end. 129 * 130 * @since 2.8.0 131 * 132 * @param string $prepend Text displayed before the post title. 133 * Default 'Private: %s'. 134 */ 113 135 $private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ) ); 114 136 $title = sprintf( $private_title_format, $title ); … … 116 138 } 117 139 140 /** 141 * Filter the post title. 142 * 143 * @since 0.71 144 * 145 * @param string $title The post title. 146 * @param int $id The post ID. 147 */ 118 148 return apply_filters( 'the_title', $title, $id ); 119 149 } … … 151 181 $post = get_post($id); 152 182 153 return apply_filters('get_the_guid', $post->guid); 183 /** 184 * Filter the Global Unique Identifier (guid) of the post. 185 * 186 * @since 1.5.0 187 * 188 * @param string $post_guid Global Unique Identifier (guid) of the post. 189 */ 190 return apply_filters( 'get_the_guid', $post->guid ); 154 191 } 155 192 … … 164 201 function the_content( $more_link_text = null, $strip_teaser = false) { 165 202 $content = get_the_content( $more_link_text, $strip_teaser ); 203 204 /** 205 * Filter the post content. 206 * 207 * @since 0.71 208 * 209 * @param string $content Content of the current post. 210 */ 166 211 $content = apply_filters( 'the_content', $content ); 167 212 $content = str_replace( ']]>', ']]>', $content ); … … 222 267 } else { 223 268 if ( ! empty( $more_link_text ) ) 269 270 /** 271 * Filter the Read More link text. 272 * 273 * @since 2.8.0 274 * 275 * @param string $more_link_element Read More link element. 276 * @param string $more_link_text Read More text. 277 */ 224 278 $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text ); 225 279 $output = force_balance_tags( $output ); … … 249 303 * 250 304 * @since 0.71 251 * @uses apply_filters() Calls 'the_excerpt' hook on post excerpt.252 305 */ 253 306 function the_excerpt() { 254 echo apply_filters('the_excerpt', get_the_excerpt()); 307 308 /** 309 * Filter the displayed post excerpt. 310 * 311 * @since 0.71 312 * 313 * @see get_the_excerpt() 314 * 315 * @param string $post_excerpt The post excerpt. 316 */ 317 echo apply_filters( 'the_excerpt', get_the_excerpt() ); 255 318 } 256 319 … … 273 336 } 274 337 338 /** 339 * Filter the retrieved post excerpt. 340 * 341 * @since 1.2.0 342 * 343 * @param string $post_excerpt The post excerpt. 344 */ 275 345 return apply_filters( 'get_the_excerpt', $post->post_excerpt ); 276 346 } … … 385 455 $classes = array_map('esc_attr', $classes); 386 456 387 return apply_filters('post_class', $classes, $class, $post->ID); 457 /** 458 * Filter the list of CSS classes for the current post. 459 * 460 * @since 2.7.0 461 * 462 * @param array $classes An array of post classes. 463 * @param string $class A comma-separated list of additional classes added to the post. 464 * @param int $post_id The post ID. 465 */ 466 return apply_filters( 'post_class', $classes, $class, $post->ID ); 388 467 } 389 468 … … 569 648 $classes = array_map( 'esc_attr', $classes ); 570 649 650 /** 651 * Filter the list of CSS body classes for the current post or page. 652 * 653 * @since 2.8.0 654 * 655 * @param array $classes An array of body classes. 656 * @param string $class A comma-separated list of additional classes added to the body. 657 */ 571 658 return apply_filters( 'body_class', $classes, $class ); 572 659 } … … 653 740 654 741 $r = wp_parse_args( $args, $defaults ); 742 743 /** 744 * Filter the arguments used in retrieving page links for paginated posts. 745 * 746 * @since 3.0.0 747 * 748 * @param array $r An array of arguments for page links for paginated posts. 749 */ 655 750 $r = apply_filters( 'wp_link_pages_args', $r ); 656 751 extract( $r, EXTR_SKIP ); … … 666 761 if ( $i != $page || ! $more && 1 == $page ) 667 762 $link = _wp_link_page( $i ) . $link . '</a>'; 763 764 /** 765 * Filter the HTML output of individual page number links. 766 * 767 * @since 3.6.0 768 * 769 * @param string $link The page number HTML output. 770 * @param int $i Page number for paginated posts' page links. 771 */ 668 772 $link = apply_filters( 'wp_link_pages_link', $link, $i ); 669 773 $output .= $separator . $link; … … 675 779 if ( $i ) { 676 780 $link = _wp_link_page( $i ) . $link_before . $previouspagelink . $link_after . '</a>'; 781 782 /** This filter is documented in wp-includes/post-template.php */ 677 783 $link = apply_filters( 'wp_link_pages_link', $link, $i ); 678 784 $output .= $separator . $link; … … 681 787 if ( $i <= $numpages ) { 682 788 $link = _wp_link_page( $i ) . $link_before . $nextpagelink . $link_after . '</a>'; 789 790 /** This filter is documented in wp-includes/post-template.php */ 683 791 $link = apply_filters( 'wp_link_pages_link', $link, $i ); 684 792 $output .= $separator . $link; … … 688 796 } 689 797 798 /** 799 * Filter the HTML output of page links for paginated posts. 800 * 801 * @since 3.6.0 802 * 803 * @param string $output HTML output of paginated posts' page links. 804 * @param array $args An array of arguments. 805 */ 690 806 $output = apply_filters( 'wp_link_pages', $output, $args ); 691 807 … … 775 891 $values = array_map('trim', get_post_custom_values($key)); 776 892 $value = implode($values,', '); 777 echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value); 893 894 /** 895 * Filter the HTML output of the li element in the post custom fields list. 896 * 897 * @since 2.2.0 898 * 899 * @param string $html The HTML output for the li element. 900 * @param string $key Meta key. 901 * @param string $value Meta value. 902 */ 903 echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value ); 778 904 } 779 905 echo "</ul>\n"; … … 821 947 } 822 948 823 $output = apply_filters('wp_dropdown_pages', $output); 949 /** 950 * Filter the HTML output of a list of pages as a drop down. 951 * 952 * @since 2.1.0 953 * 954 * @param string $output HTML output for drop down list of pages. 955 */ 956 $output = apply_filters( 'wp_dropdown_pages', $output ); 824 957 825 958 if ( $echo ) … … 858 991 // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array) 859 992 $exclude_array = ( $r['exclude'] ) ? explode(',', $r['exclude']) : array(); 860 $r['exclude'] = implode( ',', apply_filters('wp_list_pages_excludes', $exclude_array) ); 993 994 /** 995 * Filter the array of pages to exclude from the pages list. 996 * 997 * @since 2.1.0 998 * 999 * @param array $exclude_array An array of page IDs to exclude. 1000 */ 1001 $r['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) ); 861 1002 862 1003 // Query pages. … … 877 1018 } 878 1019 879 $output = apply_filters('wp_list_pages', $output, $r); 1020 /** 1021 * Filter the HTML output of the pages to list. 1022 * 1023 * @since 1.5.1 1024 * 1025 * @see wp_list_pages() 1026 * 1027 * @param string $output HTML output of the pages list. 1028 * @param array $r An array of page-listing arguments. 1029 */ 1030 $output = apply_filters( 'wp_list_pages', $output, $r ); 880 1031 881 1032 if ( $r['echo'] ) … … 914 1065 $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => ''); 915 1066 $args = wp_parse_args( $args, $defaults ); 1067 1068 /** 1069 * Filter the arguments used to generate a page-based menu. 1070 * 1071 * @since 2.7.0 1072 * 1073 * @see wp_page_menu() 1074 * 1075 * @param array $args An array of page menu arguments. 1076 */ 916 1077 $args = apply_filters( 'wp_page_menu_args', $args ); 917 1078 … … 949 1110 950 1111 $menu = '<div class="' . esc_attr($args['menu_class']) . '">' . $menu . "</div>\n"; 1112 1113 /** 1114 * Filter the HTML output of a page-based menu. 1115 * 1116 * @since 2.7.0 1117 * 1118 * @see wp_page_menu() 1119 * 1120 * @param string $menu The HTML output. 1121 * @param array $args An array of arguments. 1122 */ 951 1123 $menu = apply_filters( 'wp_page_menu', $menu, $args ); 952 1124 if ( $args['echo'] ) … … 1081 1253 } 1082 1254 1255 /** 1256 * Filter the list of CSS classes to include with each page item in the list. 1257 * 1258 * @since 2.8.0 1259 * 1260 * @see wp_list_pages() 1261 * 1262 * @param array $css_class An array of CSS classes to be applied 1263 * to each list item. 1264 * @param WP_Post $page Page data object. 1265 * @param int $depth Depth of page, used for padding. 1266 * @param array $args An array of arguments. 1267 * @param int $current_page ID of the current page. 1268 */ 1083 1269 $css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) ); 1084 1270 … … 1159 1345 } 1160 1346 1347 /** 1348 * Filter the page title when creating an HTML drop-down list of pages. 1349 * 1350 * @since 3.1.0 1351 * 1352 * @param string $title Page title. 1353 * @param object $page Page data object. 1354 */ 1161 1355 $title = apply_filters( 'list_pages', $title, $page ); 1162 1356 $output .= $pad . esc_html( $title ); … … 1224 1418 $link_text = $_post->post_title; 1225 1419 1420 /** 1421 * Filter a retrieved attachment page link. 1422 * 1423 * @since 2.7.0 1424 * 1425 * @param string $link_html The page link HTML output. 1426 * @param int $id Post ID. 1427 * @param string $size Image size. Default 'thumbnail'. 1428 * @param bool $permalink Whether to add permalink to image. Default false. 1429 * @param bool $icon Whether to include an icon. Default false. 1430 * @param string|bool $text If string, will be link text. Default false. 1431 */ 1226 1432 return apply_filters( 'wp_get_attachment_link', "<a href='$url'>$link_text</a>", $id, $size, $permalink, $icon, $text ); 1227 1433 } … … 1231 1437 * 1232 1438 * @since 2.0.0 1233 * @uses apply_filters() Calls 'prepend_attachment' hook on HTML content.1234 1439 * 1235 1440 * @param string $content … … 1259 1464 endif; 1260 1465 1261 $p = apply_filters('prepend_attachment', $p); 1466 /** 1467 * Filter the attachment markup to be prepended to the post content. 1468 * 1469 * @since 2.0.0 1470 * 1471 * @see prepend_attachment() 1472 * 1473 * @param string $p The attachment HTML output. 1474 */ 1475 $p = apply_filters( 'prepend_attachment', $p ); 1262 1476 1263 1477 return "$p\n$content"; … … 1283 1497 <p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__( 'Submit' ) . '" /></p></form> 1284 1498 '; 1499 1500 /** 1501 * Filter the HTML output for the protected post password form. 1502 * 1503 * If modifying the password field, please note that the core database schema 1504 * limits the password field to 20 characters regardless of the value of the 1505 * size attribute in the form input. 1506 * 1507 * @since 2.7.0 1508 * 1509 * @param string $output The password form HTML output. 1510 */ 1285 1511 return apply_filters( 'the_password_form', $output ); 1286 1512 }
Note: See TracChangeset
for help on using the changeset viewer.