Making WordPress.org


Ignore:
Timestamp:
11/05/2015 06:55:27 PM (9 years ago)
Author:
coffee2code
Message:

learn.wordpress.org: Use wp_get_document_title() instead of the deprecated wp_title().

Also ensure front page document title omits front page's title ("Front Page").

See #1353.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn/functions.php

    r4 r2043  
    2222}
    2323
     24/**
     25 * Omit page name from front page title.
     26 *
     27 * @param array $parts The document title parts.
     28 * @return array The document title parts.
     29 */
     30function learn_remove_frontpage_name_from_title( $parts ) {
     31    if ( is_front_page() ) {
     32        $parts['title'] = '';
     33    }
    2434
     35    return $parts; 
     36}
     37add_filter( 'document_title_parts', 'learn_remove_frontpage_name_from_title' );
     38
Note: See TracChangeset for help on using the changeset viewer.