WordPress.org

Making WordPress.org

Changeset 2043


Ignore:
Timestamp:
11/05/2015 06:55:27 PM (4 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.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn
Files:
2 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
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn/header.php

    r4 r2043  
    11<?php
    22global $pagetitle;
    3 $pagetitle = wp_title( '&laquo;', false, 'right' ) . ' ' . get_bloginfo( 'name' );
     3$pagetitle = wp_get_document_title();
    44wp_enqueue_style( 'wporg-learn', get_bloginfo( 'stylesheet_url' ), array(), 2, 'screen' );
    55wp_enqueue_style( 'wporg-learn-fonts', '//fonts.googleapis.com/css?family=Roboto+Condensed:700', array(), 1, 'screen' );
Note: See TracChangeset for help on using the changeset viewer.