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
This commit is contained in:
Ian Stewart 2014-10-29 21:56:23 +00:00
parent 56f55ea507
commit e68c17cb7b
3 changed files with 9 additions and 34 deletions

View File

@ -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 <title> 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.
*

View File

@ -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' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<!--[if lt IE 9]>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.1-alpha-30096';
$wp_version = '4.1-alpha-30097';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.