Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-template.php

    r47088 r47122  
    314314        }
    315315
    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'] );
    318320        }
    319321
     
    452454 */
    453455function 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.
    455457        echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"';
    456458}
     
    503505        $classes[] = 'status-' . $post->post_status;
    504506
    505         // Post Format
     507        // Post Format.
    506508        if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
    507509                $post_format = get_post_format( $post->ID );
     
    528530        }
    529531
    530         // sticky for Sticky Posts
     532        // Sticky for Sticky Posts.
    531533        if ( is_sticky( $post->ID ) ) {
    532534                if ( is_home() && ! is_paged() ) {
     
    537539        }
    538540
    539         // hentry for hAtom compliance
     541        // hentry for hAtom compliance.
    540542        $classes[] = 'hentry';
    541543
    542         // All public taxonomies
     544        // All public taxonomies.
    543545        $taxonomies = get_taxonomies( array( 'public' => true ) );
    544546        foreach ( (array) $taxonomies as $taxonomy ) {
     
    588590 */
    589591function 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.
    591593        echo 'class="' . join( ' ', get_body_class( $class ) ) . '"';
    592594}
     
    665667                                $classes[] = 'postid-' . $post_id;
    666668
    667                                 // Post Format
     669                                // Post Format.
    668670                                if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
    669671                                        $post_format = get_post_format( $post->ID );
     
    879881
    880882//
    881 // Page Template Functions for usage in Themes
     883// Page Template Functions for usage in Themes.
    882884//
    883885
     
    11241126
    11251127//
    1126 // Pages
     1128// Pages.
    11271129//
    11281130
     
    11761178        $pages  = get_pages( $parsed_args );
    11771179        $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.
    11791181        if ( empty( $parsed_args['id'] ) ) {
    11801182                $parsed_args['id'] = $parsed_args['name'];
     
    12771279
    12781280        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.
    12801282                $parsed_args['item_spacing'] = $defaults['item_spacing'];
    12811283        }
     
    12841286        $current_page = 0;
    12851287
    1286         // sanitize, mostly to keep spaces out
     1288        // Sanitize, mostly to keep spaces out.
    12871289        $parsed_args['exclude'] = preg_replace( '/[^0-9,]/', '', $parsed_args['exclude'] );
    12881290
    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).
    12901292        $exclude_array = ( $parsed_args['exclude'] ) ? explode( ',', $parsed_args['exclude'] ) : array();
    12911293
     
    13951397
    13961398        if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ) ) ) {
    1397                 // invalid value, fall back to default.
     1399                // Invalid value, fall back to default.
    13981400                $args['item_spacing'] = $defaults['item_spacing'];
    13991401        }
     
    14221424        $list_args = $args;
    14231425
    1424         // Show Home in the menu
     1426        // Show Home in the menu.
    14251427        if ( ! empty( $args['show_home'] ) ) {
    14261428                if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) {
     
    14341436                }
    14351437                $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.
    14371439                if ( get_option( 'show_on_front' ) == 'page' ) {
    14381440                        if ( ! empty( $list_args['exclude'] ) ) {
     
    14581460        if ( $menu ) {
    14591461
    1460                 // wp_nav_menu doesn't set before and after
     1462                // wp_nav_menu() doesn't set before and after.
    14611463                if ( isset( $args['fallback_cb'] ) &&
    14621464                        'wp_page_menu' === $args['fallback_cb'] &&
     
    15001502
    15011503//
    1502 // Page helpers
     1504// Page helpers.
    15031505//
    15041506
     
    15441546 */
    15451547function walk_page_dropdown_tree( ...$args ) {
    1546         if ( empty( $args[2]['walker'] ) ) { // the user's options are the third parameter
     1548        if ( empty( $args[2]['walker'] ) ) { // The user's options are the third parameter.
    15471549                $walker = new Walker_PageDropdown;
    15481550        } else {
     
    15541556
    15551557//
    1556 // Attachments
     1558// Attachments.
    15571559//
    15581560
     
    16721674        } else {
    16731675                $p = '<p class="attachment">';
    1674                 // show the medium sized image representation of the attachment if available, and link to the raw file
     1676                // Show the medium sized image representation of the attachment if available, and link to the raw file.
    16751677                $p .= wp_get_attachment_link( 0, 'medium', false );
    16761678                $p .= '</p>';
     
    16921694
    16931695//
    1694 // Misc
     1696// Misc.
    16951697//
    16961698
     
    19171919        }
    19181920
    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.
    19201922        if ( is_array( $type ) ) {
    19211923                $type = ! empty( $type['type'] ) ? $type['type'] : $type;
Note: See TracChangeset for help on using the changeset viewer.