mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-24 01:57:53 +01:00
Twenty Twelve: make title truly pluggable by moving output from header.php to a function. Props obenland, fixes #21233.
git-svn-id: http://core.svn.wordpress.org/trunk@21276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a7221773c5
commit
0e8c8fb1e3
@ -130,6 +130,31 @@ function twentytwelve_scripts_styles() {
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' );
|
||||
|
||||
/**
|
||||
* Creates a nicely formatted and more specific title element text
|
||||
* for output in head of document, based on current view.
|
||||
*
|
||||
* @since Twenty Twelve 1.0
|
||||
*/
|
||||
function twentytwelve_wp_title( $title, $sep ) {
|
||||
global $paged, $page;
|
||||
|
||||
// Add the blog name.
|
||||
$title .= get_bloginfo( 'name' );
|
||||
|
||||
// Add the blog description for the home/front page.
|
||||
$site_description = get_bloginfo( 'description', 'display' );
|
||||
if ( $site_description && ( is_home() || is_front_page() ) )
|
||||
$title = "$title $sep $site_description";
|
||||
|
||||
// Add a page number if necessary.
|
||||
if ( $paged >= 2 || $page >= 2 )
|
||||
$title = "$title $sep " . sprintf( __( 'Page %s', 'twentytwelve' ), max( $paged, $page ) );
|
||||
|
||||
return $title;
|
||||
}
|
||||
add_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 );
|
||||
|
||||
/**
|
||||
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
|
||||
*
|
||||
|
@ -13,7 +13,7 @@
|
||||
<head>
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title><?php wp_title( '|', true, 'right' ); ?><?php echo bloginfo( 'name' ); ?></title>
|
||||
<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]>
|
||||
|
Loading…
Reference in New Issue
Block a user