Make WordPress Core


Ignore:
Timestamp:
10/20/2015 06:30:59 PM (9 years ago)
Author:
DrewAPicture
Message:

Docs: Fix indentation and improve usefulness of inline comments surrounding the if/elseif conditions for assigning document titles in wp_get_document_title().

See #31078. See #32246.

File:
1 edited

Legend:

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

    r35298 r35300  
    814814    );
    815815
     816    // If on the home or front page, use the site title.
    816817    if ( is_home() && is_front_page() ) {
    817818        $title['title'] = get_bloginfo( 'name', 'display' );
    818819
    819         /*
    820          * If we're on the blog page and that page is not the homepage or a single page that is designated as
    821          * the homepage, use the container page's title.
    822         */
     820    /*
     821     * If we're on the blog page and that page is not the homepage or a single
     822     * page that is designated as the homepage, use the container page's title.
     823    */
    823824    } elseif ( ( is_home() && ! is_front_page() ) || ( ! is_home() && is_front_page() ) ) {
    824825        $title['title'] = single_post_title( '', false );
    825826
    826         // If we're on a post / page.
     827    // If on a single post of any post type, use the post title.
    827828    } elseif ( is_singular() ) {
    828829        $title['title'] = single_post_title( '', false );
    829830
    830         // If we're on a category or tag or taxonomy archive.
     831    // If on a category or tag or taxonomy archive, use the archive title.
    831832    } elseif ( is_category() || is_tag() || is_tax() ) {
    832833        $title['title'] = single_term_title( '', false );
    833834
    834         // If it's a search.
     835    // If it's a search, use a dynamic search results title.
    835836    } elseif ( is_search() ) {
    836837        /* translators: %s: search phrase */
    837838        $title['title'] = sprintf( __( 'Search Results for “%s”' ), get_search_query() );
    838839
    839         // If we're on an author archive.
     840    // If on an author archive, use the author's display name.
    840841    } elseif ( is_author() && $author = get_queried_object() ) {
    841842        $title['title'] = $author->display_name;
    842843
    843         // If we're on a post type archive.
     844    // If on a post type archive, use the post type archive title.
    844845    } elseif ( is_post_type_archive() ) {
    845846        $title['title'] = post_type_archive_title( '', false );
    846847
    847         // If it's a date archive.
     848    // If it's a date archive, use the date as the title.
    848849    } elseif ( is_year() ) {
    849850        $title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) );
     
    855856        $title['title'] = get_the_date();
    856857
    857         // If it's a 404 page.
     858    // If it's a 404 page, use a "Page not found" title.
    858859    } elseif ( is_404() ) {
    859860        $title['title'] = __( 'Page not found' );
Note: See TracChangeset for help on using the changeset viewer.