Ticket #18548: 18548.5.diff
File 18548.5.diff, 4.0 KB (added by , 10 years ago) |
---|
-
src/wp-includes/default-filters.php
155 155 156 156 add_filter( 'wp_sprintf', 'wp_sprintf_l', 10, 2 ); 157 157 158 add_filter( 'wp_title', '_wp_enhance_title_output', 10, 2 ); 159 158 160 // RSS filters 159 161 add_filter( 'the_title_rss', 'strip_tags' ); 160 162 add_filter( 'the_title_rss', 'ent2ncr', 8 ); … … 196 198 add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 ); 197 199 198 200 // Actions 201 add_action( 'wp_head', '_wp_render_title_tag', 1 ); 199 202 add_action( 'wp_head', 'wp_enqueue_scripts', 1 ); 200 203 add_action( 'wp_head', 'feed_links', 2 ); 201 204 add_action( 'wp_head', 'feed_links_extra', 3 ); -
src/wp-includes/general-template.php
731 731 } 732 732 733 733 /** 734 * Display <title> tag with contents. 735 * 736 * @since 4.1.0 737 * @access private 738 */ 739 function _wp_render_title_tag() { 740 if ( ! current_theme_supports( 'title-tag' ) ) { 741 return; 742 } 743 744 // This can only work internally on wp_head. 745 if ( ! did_action( 'wp_head' ) && ( ! function_exists( 'doing_action' ) || ! doing_action( 'wp_head' ) ) ) { 746 return; 747 } 748 749 echo "<title>" . wp_title( '|', false, 'right' ) . "</title>\n"; 750 } 751 752 /** 753 * Filters wp_title to return a neat <title> tag content based on what is being viewed. 754 * 755 * @since 4.1.0 756 * @access private 757 * 758 * @param string $title Default title text for current view. 759 * @param string $sep Optional separator. 760 * @return string The filtered title. 761 */ 762 function _wp_enhance_title_output( $title, $sep ) { 763 if ( ! current_theme_supports( 'title-tag' ) || is_feed() ) { 764 return $title; 765 } 766 767 global $page, $paged; 768 769 // Add the blog name 770 $title .= get_bloginfo( 'name', 'display' ); 771 772 // Add the blog description for the home/front page. 773 $site_description = get_bloginfo( 'description', 'display' ); 774 if ( $site_description && ( is_home() || is_front_page() ) ) { 775 $title .= " $sep $site_description"; 776 } 777 778 // Add a page number if necessary: 779 if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { 780 $title .= " $sep " . sprintf( __( 'Page %s' ), max( $paged, $page ) ); 781 } 782 783 return $title; 784 } 785 786 /** 734 787 * Display or retrieve page title for all areas of blog. 735 788 * 736 789 * By default, the page title will display the separator before the page title, -
src/wp-includes/theme.php
1607 1607 define( 'BACKGROUND_IMAGE', $args[0]['default-image'] ); 1608 1608 1609 1609 break; 1610 1611 // Ensure that 'title-tag' is accessible in the admin. 1612 case 'title-tag' : 1613 if ( function_exists( 'doing_action' ) 1614 && ! doing_action( 'after_setup_theme' ) // can be called here 1615 && ! doing_action( 'init' ) // can also be called here 1616 && ( doing_action() || did_action( 'wp_loaded' ) ) // can be called in functions.php but must happen before wp_loaded, i.e. not in header.php 1617 ) { 1618 _doing_it_wrong( "add_theme_support( 'title-tag' )", __( "You need to add support before 'wp_loaded'." ), '4.1.0' ); 1619 } 1620 break; 1610 1621 } 1611 1622 1612 1623 $_wp_theme_features[ $feature ] = $args; … … 1759 1770 if ( !isset( $_wp_theme_features[$feature] ) ) 1760 1771 return false; 1761 1772 1773 if ( 'title-tag' == $feature ) { 1774 // Don't confirm support unless called internally. 1775 $trace = debug_backtrace(); 1776 if ( ! in_arraY( $trace[1]['function'], array( '_wp_render_title_tag', '_wp_enhance_title_output' ) ) ) { 1777 return false; 1778 } 1779 } 1780 1762 1781 // If no args passed then no extra checks need be performed 1763 1782 if ( func_num_args() <= 1 ) 1764 1783 return true;