Changeset 47122 for trunk/src/wp-includes/post-template.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/post-template.php (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-template.php
r47088 r47122 314 314 } 315 315 316 if ( $elements['page'] > count( $elements['pages'] ) ) { // if the requested page doesn't exist 317 $elements['page'] = count( $elements['pages'] ); // give them the highest numbered page that DOES exist 316 // If the requested page doesn't exist. 317 if ( $elements['page'] > count( $elements['pages'] ) ) { 318 // Give them the highest numbered page that DOES exist. 319 $elements['page'] = count( $elements['pages'] ); 318 320 } 319 321 … … 452 454 */ 453 455 function post_class( $class = '', $post_id = null ) { 454 // Separates classes with a single space, collates classes for post DIV 456 // Separates classes with a single space, collates classes for post DIV. 455 457 echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"'; 456 458 } … … 503 505 $classes[] = 'status-' . $post->post_status; 504 506 505 // Post Format 507 // Post Format. 506 508 if ( post_type_supports( $post->post_type, 'post-formats' ) ) { 507 509 $post_format = get_post_format( $post->ID ); … … 528 530 } 529 531 530 // sticky for Sticky Posts532 // Sticky for Sticky Posts. 531 533 if ( is_sticky( $post->ID ) ) { 532 534 if ( is_home() && ! is_paged() ) { … … 537 539 } 538 540 539 // hentry for hAtom compliance 541 // hentry for hAtom compliance. 540 542 $classes[] = 'hentry'; 541 543 542 // All public taxonomies 544 // All public taxonomies. 543 545 $taxonomies = get_taxonomies( array( 'public' => true ) ); 544 546 foreach ( (array) $taxonomies as $taxonomy ) { … … 588 590 */ 589 591 function body_class( $class = '' ) { 590 // Separates class names with a single space, collates class names for body element 592 // Separates class names with a single space, collates class names for body element. 591 593 echo 'class="' . join( ' ', get_body_class( $class ) ) . '"'; 592 594 } … … 665 667 $classes[] = 'postid-' . $post_id; 666 668 667 // Post Format 669 // Post Format. 668 670 if ( post_type_supports( $post->post_type, 'post-formats' ) ) { 669 671 $post_format = get_post_format( $post->ID ); … … 879 881 880 882 // 881 // Page Template Functions for usage in Themes 883 // Page Template Functions for usage in Themes. 882 884 // 883 885 … … 1124 1126 1125 1127 // 1126 // Pages 1128 // Pages. 1127 1129 // 1128 1130 … … 1176 1178 $pages = get_pages( $parsed_args ); 1177 1179 $output = ''; 1178 // Back-compat with old system where both id and name were based on $name argument 1180 // Back-compat with old system where both id and name were based on $name argument. 1179 1181 if ( empty( $parsed_args['id'] ) ) { 1180 1182 $parsed_args['id'] = $parsed_args['name']; … … 1277 1279 1278 1280 if ( ! in_array( $parsed_args['item_spacing'], array( 'preserve', 'discard' ), true ) ) { 1279 // invalid value, fall back to default.1281 // Invalid value, fall back to default. 1280 1282 $parsed_args['item_spacing'] = $defaults['item_spacing']; 1281 1283 } … … 1284 1286 $current_page = 0; 1285 1287 1286 // sanitize, mostly to keep spaces out1288 // Sanitize, mostly to keep spaces out. 1287 1289 $parsed_args['exclude'] = preg_replace( '/[^0-9,]/', '', $parsed_args['exclude'] ); 1288 1290 1289 // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array) 1291 // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array). 1290 1292 $exclude_array = ( $parsed_args['exclude'] ) ? explode( ',', $parsed_args['exclude'] ) : array(); 1291 1293 … … 1395 1397 1396 1398 if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ) ) ) { 1397 // invalid value, fall back to default.1399 // Invalid value, fall back to default. 1398 1400 $args['item_spacing'] = $defaults['item_spacing']; 1399 1401 } … … 1422 1424 $list_args = $args; 1423 1425 1424 // Show Home in the menu 1426 // Show Home in the menu. 1425 1427 if ( ! empty( $args['show_home'] ) ) { 1426 1428 if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) { … … 1434 1436 } 1435 1437 $menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>'; 1436 // If the front page is a page, add it to the exclude list 1438 // If the front page is a page, add it to the exclude list. 1437 1439 if ( get_option( 'show_on_front' ) == 'page' ) { 1438 1440 if ( ! empty( $list_args['exclude'] ) ) { … … 1458 1460 if ( $menu ) { 1459 1461 1460 // wp_nav_menu doesn't set before and after1462 // wp_nav_menu() doesn't set before and after. 1461 1463 if ( isset( $args['fallback_cb'] ) && 1462 1464 'wp_page_menu' === $args['fallback_cb'] && … … 1500 1502 1501 1503 // 1502 // Page helpers 1504 // Page helpers. 1503 1505 // 1504 1506 … … 1544 1546 */ 1545 1547 function walk_page_dropdown_tree( ...$args ) { 1546 if ( empty( $args[2]['walker'] ) ) { // the user's options are the third parameter1548 if ( empty( $args[2]['walker'] ) ) { // The user's options are the third parameter. 1547 1549 $walker = new Walker_PageDropdown; 1548 1550 } else { … … 1554 1556 1555 1557 // 1556 // Attachments 1558 // Attachments. 1557 1559 // 1558 1560 … … 1672 1674 } else { 1673 1675 $p = '<p class="attachment">'; 1674 // show the medium sized image representation of the attachment if available, and link to the raw file1676 // Show the medium sized image representation of the attachment if available, and link to the raw file. 1675 1677 $p .= wp_get_attachment_link( 0, 'medium', false ); 1676 1678 $p .= '</p>'; … … 1692 1694 1693 1695 // 1694 // Misc 1696 // Misc. 1695 1697 // 1696 1698 … … 1917 1919 } 1918 1920 1919 // $args array with (parent, format, right, left, type) deprecated since 3.6 1921 // $args array with (parent, format, right, left, type) deprecated since 3.6. 1920 1922 if ( is_array( $type ) ) { 1921 1923 $type = ! empty( $type['type'] ) ? $type['type'] : $type;
Note: See TracChangeset
for help on using the changeset viewer.