Make WordPress Core

Ticket #34456: 34456.5.diff

File 34456.5.diff, 6.8 KB (added by Nikschavan, 9 years ago)
  • src/wp-content/themes/twentyfourteen/functions.php

    diff --git src/wp-content/themes/twentyfourteen/functions.php src/wp-content/themes/twentyfourteen/functions.php
    index 4e65214..b17e619 100644
    function twentyfourteen_setup() { 
    113113
    114114        // This theme uses its own gallery styles.
    115115        add_filter( 'use_default_gallery_style', '__return_false' );
     116
     117        /*
     118         * Let WordPress manage the document title.
     119         * By adding theme support, we declare that this theme does not use a
     120         * hard-coded <title> tag in the document head, and expect WordPress to
     121         * provide it for us.
     122         */
     123        if ( function_exists( '_wp_render_title_tag' ) ) {
     124                add_theme_support( 'title-tag' );
     125        } else {               
     126                add_action( 'wp_head', 'twentyfourteen_render_title' );
     127                add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 );
     128        }
     129
    116130}
    117131endif; // twentyfourteen_setup
    118132add_action( 'after_setup_theme', 'twentyfourteen_setup' );
    function twentyfourteen_post_classes( $classes ) { 
    462476add_filter( 'post_class', 'twentyfourteen_post_classes' );
    463477
    464478/**
     479 * Provide backwords compatibility for the title-tag theme support.
     480 *
     481 * Adds <title> tags in the head of the document.
     482 *
     483 * @since Twenty Fourteen 1.6
     484 */
     485function twentyfourteen_render_title() {
     486        ?>
     487        <title><?php wp_title( '|', true, 'right' ); ?></title>
     488        <?php
     489}
     490
     491/**
    465492 * Create a nicely formatted and more specific title element text for output
    466493 * in head of document, based on current view.
    467494 *
    function twentyfourteen_wp_title( $title, $sep ) { 
    497524
    498525        return $title;
    499526}
    500 add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 );
    501527
    502528// Implement Custom Header features.
    503529require get_template_directory() . '/inc/custom-header.php';
  • src/wp-content/themes/twentyfourteen/header.php

    diff --git src/wp-content/themes/twentyfourteen/header.php src/wp-content/themes/twentyfourteen/header.php
    index 7286d88..5730ad8 100644
     
    2121<head>
    2222        <meta charset="<?php bloginfo( 'charset' ); ?>">
    2323        <meta name="viewport" content="width=device-width">
    24         <title><?php wp_title( '|', true, 'right' ); ?></title>
    2524        <link rel="profile" href="http://gmpg.org/xfn/11">
    2625        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    2726        <!--[if lt IE 9]>
  • src/wp-content/themes/twentythirteen/functions.php

    diff --git src/wp-content/themes/twentythirteen/functions.php src/wp-content/themes/twentythirteen/functions.php
    index e87761f..5eacb55 100644
    function twentythirteen_setup() { 
    105105
    106106        // This theme uses its own gallery styles.
    107107        add_filter( 'use_default_gallery_style', '__return_false' );
     108
     109        /*
     110         * Let WordPress manage the document title.
     111         * By adding theme support, we declare that this theme does not use a
     112         * hard-coded <title> tag in the document head, and expect WordPress to
     113         * provide it for us.
     114         */
     115        if ( function_exists( '_wp_render_title_tag' ) ) {
     116                add_theme_support( 'title-tag' );
     117        } else {               
     118                add_action( 'wp_head', 'twentythirteen_render_title' );
     119                add_filter( 'wp_title', 'twentythirteen_wp_title', 10, 2 );
     120        }
     121
    108122}
    109123add_action( 'after_setup_theme', 'twentythirteen_setup' );
    110124
    function twentythirteen_scripts_styles() { 
    188202add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' );
    189203
    190204/**
     205 * Provide backwords compatibility for the title-tag theme support.
     206 *
     207 * Adds <title> tags in the head of the document.
     208 *
     209 * @since Twenty Thirteen 1.7
     210 */
     211function twentythirteen_render_title() {
     212        ?>
     213        <title><?php wp_title( '|', true, 'right' ); ?></title>
     214        <?php
     215}
     216
     217/**
    191218 * Filter the page title.
    192219 *
    193220 * Creates a nicely formatted and more specific title element text for output
    function twentythirteen_wp_title( $title, $sep ) { 
    219246
    220247        return $title;
    221248}
    222 add_filter( 'wp_title', 'twentythirteen_wp_title', 10, 2 );
    223249
    224250/**
    225251 * Register two widget areas.
  • src/wp-content/themes/twentythirteen/header.php

    diff --git src/wp-content/themes/twentythirteen/header.php src/wp-content/themes/twentythirteen/header.php
    index 094f74c..43d90b3 100644
     
    2121<head>
    2222        <meta charset="<?php bloginfo( 'charset' ); ?>">
    2323        <meta name="viewport" content="width=device-width">
    24         <title><?php wp_title( '|', true, 'right' ); ?></title>
    2524        <link rel="profile" href="http://gmpg.org/xfn/11">
    2625        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    2726        <!--[if lt IE 9]>
  • src/wp-content/themes/twentytwelve/functions.php

    diff --git src/wp-content/themes/twentytwelve/functions.php src/wp-content/themes/twentytwelve/functions.php
    index 8d5facf..12e6bd6 100644
    function twentytwelve_setup() { 
    7474        // This theme uses a custom image size for featured images, displayed on "standard" posts.
    7575        add_theme_support( 'post-thumbnails' );
    7676        set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop
     77
     78        /*
     79         * Let WordPress manage the document title.
     80         * By adding theme support, we declare that this theme does not use a
     81         * hard-coded <title> tag in the document head, and expect WordPress to
     82         * provide it for us.
     83         */
     84        if ( function_exists( '_wp_render_title_tag' ) ) {
     85                add_theme_support( 'title-tag' );
     86        } else {               
     87                add_action( 'wp_head', 'twentytwelve_render_title' );
     88                add_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 );
     89        }
     90
    7791}
    7892add_action( 'after_setup_theme', 'twentytwelve_setup' );
    7993
    function twentytwelve_mce_css( $mce_css ) { 
    182196add_filter( 'mce_css', 'twentytwelve_mce_css' );
    183197
    184198/**
     199 * Provide backwords compatibility for the title-tag theme support.
     200 *
     201 * Adds <title> tags in the head of the document.
     202 *
     203 * @since Twenty Twelve 1.9
     204 */
     205function twentytwelve_render_title() {
     206        ?>
     207        <title><?php wp_title( '|', true, 'right' ); ?></title>
     208        <?php
     209}
     210
     211/**
    185212 * Filter the page title.
    186213 *
    187214 * Creates a nicely formatted and more specific title element text
    function twentytwelve_wp_title( $title, $sep ) { 
    213240
    214241        return $title;
    215242}
    216 add_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 );
    217243
    218244/**
    219245 * Filter the page menu arguments.
  • src/wp-content/themes/twentytwelve/header.php

    diff --git src/wp-content/themes/twentytwelve/header.php src/wp-content/themes/twentytwelve/header.php
    index c3b99d6..6bcf269 100644
     
    2121<head>
    2222<meta charset="<?php bloginfo( 'charset' ); ?>" />
    2323<meta name="viewport" content="width=device-width" />
    24 <title><?php wp_title( '|', true, 'right' ); ?></title>
    2524<link rel="profile" href="http://gmpg.org/xfn/11" />
    2625<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    2726<?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>