From e68c17cb7bcc95bd0464999fb62c1be5c01613e9 Mon Sep 17 00:00:00 2001 From: Ian Stewart Date: Wed, 29 Oct 2014 21:56:23 +0000 Subject: [PATCH] Twenty Fifteen: leading the way with support for title-tag Props obenland, fixes #30146. Built from https://develop.svn.wordpress.org/trunk@30097 git-svn-id: http://core.svn.wordpress.org/trunk@30097 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyfifteen/functions.php | 40 ++++--------------- wp-content/themes/twentyfifteen/header.php | 1 - wp-includes/version.php | 2 +- 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/wp-content/themes/twentyfifteen/functions.php b/wp-content/themes/twentyfifteen/functions.php index dccfc451e2..cc0d81639c 100644 --- a/wp-content/themes/twentyfifteen/functions.php +++ b/wp-content/themes/twentyfifteen/functions.php @@ -57,6 +57,14 @@ function twentyfifteen_setup() { // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); + /* + * Let WordPress manage the document title. + * By adding theme support, we declare that this theme does not use a + * hard-coded tag in the document head, and expect WordPress to + * provide it for us. + */ + add_theme_support( 'title-tag' ); + /* * Enable support for Post Thumbnails on posts and pages. * @@ -225,38 +233,6 @@ function twentyfifteen_scripts() { } add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' ); -/** - * Filters wp_title to print a neat <title> tag based on what is being viewed. - * - * @param string $title Default title text for current view. - * @param string $sep Optional separator. - * @return string The filtered title. - */ -function twentyfifteen_wp_title( $title, $sep ) { - if ( is_feed() ) { - return $title; - } - - global $page, $paged; - - // Add the blog name - $title .= get_bloginfo( 'name', 'display' ); - - // Add the blog description for the home/front page. - $site_description = get_bloginfo( 'description', 'display' ); - if ( $site_description && ( is_home() || is_front_page() ) ) { - $title .= " $sep $site_description"; - } - - // Add a page number if necessary: - if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { - $title .= " $sep " . sprintf( __( 'Page %s', 'twentyfifteen' ), max( $paged, $page ) ); - } - - return $title; -} -add_filter( 'wp_title', 'twentyfifteen_wp_title', 10, 2 ); - /** * Add featured image as background image to post navs. * diff --git a/wp-content/themes/twentyfifteen/header.php b/wp-content/themes/twentyfifteen/header.php index 8fbfa465da..ca8f1a5a0d 100644 --- a/wp-content/themes/twentyfifteen/header.php +++ b/wp-content/themes/twentyfifteen/header.php @@ -13,7 +13,6 @@ <head> <meta charset="<?php bloginfo( 'charset' ); ?>"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <title><?php wp_title( '|', true, 'right' ); ?>