Make wp_title() sort titles based on separator direction. Reverse the titles in bundled theme. Better SEO. fixes #7338
git-svn-id: https://develop.svn.wordpress.org/trunk@9376 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
83f404323b
commit
c33b1bc527
@ -10,7 +10,7 @@
|
|||||||
<head profile="http://gmpg.org/xfn/11">
|
<head profile="http://gmpg.org/xfn/11">
|
||||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
|
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
|
||||||
|
|
||||||
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
|
<title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>
|
||||||
|
|
||||||
<style type="text/css" media="screen">
|
<style type="text/css" media="screen">
|
||||||
@import url( <?php bloginfo('stylesheet_url'); ?> );
|
@import url( <?php bloginfo('stylesheet_url'); ?> );
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<head profile="http://gmpg.org/xfn/11">
|
<head profile="http://gmpg.org/xfn/11">
|
||||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
|
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
|
||||||
|
|
||||||
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
|
<title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
|
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
|
||||||
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
|
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
|
||||||
|
@ -377,6 +377,8 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
|
|||||||
$day = get_query_var('day');
|
$day = get_query_var('day');
|
||||||
$title = '';
|
$title = '';
|
||||||
|
|
||||||
|
$t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary
|
||||||
|
|
||||||
// If there's a category
|
// If there's a category
|
||||||
if ( !empty($cat) ) {
|
if ( !empty($cat) ) {
|
||||||
// category exclusion
|
// category exclusion
|
||||||
@ -418,15 +420,15 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
|
|||||||
$my_year = substr($m, 0, 4);
|
$my_year = substr($m, 0, 4);
|
||||||
$my_month = $wp_locale->get_month(substr($m, 4, 2));
|
$my_month = $wp_locale->get_month(substr($m, 4, 2));
|
||||||
$my_day = intval(substr($m, 6, 2));
|
$my_day = intval(substr($m, 6, 2));
|
||||||
$title = "$my_year" . ($my_month ? "$sep $my_month" : "") . ($my_day ? "$sep $my_day" : "");
|
$title = "$my_year" . ($my_month ? "$t_sep$my_month" : "") . ($my_day ? "$t_sep$my_day" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($year) ) {
|
if ( !empty($year) ) {
|
||||||
$title = $year;
|
$title = $year;
|
||||||
if ( !empty($monthnum) )
|
if ( !empty($monthnum) )
|
||||||
$title .= " $sep " . $wp_locale->get_month($monthnum);
|
$title .= "$t_sep" . $wp_locale->get_month($monthnum);
|
||||||
if ( !empty($day) )
|
if ( !empty($day) )
|
||||||
$title .= " $sep " . zeroise($day, 2);
|
$title .= "$t_sep" . zeroise($day, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a post
|
// If there is a post
|
||||||
@ -442,10 +444,7 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
|
|||||||
$tax = $tax->label;
|
$tax = $tax->label;
|
||||||
$term = $wp_query->get_queried_object();
|
$term = $wp_query->get_queried_object();
|
||||||
$term = $term->name;
|
$term = $term->name;
|
||||||
if ( 'right' == $seplocation )
|
$title = "$tax$t_sep$term";
|
||||||
$title = "$term $sep $tax";
|
|
||||||
else
|
|
||||||
$title = "$tax $sep $term";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_404() ) {
|
if ( is_404() ) {
|
||||||
@ -456,11 +455,15 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
|
|||||||
if ( !empty($title) )
|
if ( !empty($title) )
|
||||||
$prefix = " $sep ";
|
$prefix = " $sep ";
|
||||||
|
|
||||||
// Determines position of the separator
|
// Determines position of the separator and direction of the breadcrumb
|
||||||
if ( 'right' == $seplocation )
|
if ( 'right' == $seplocation ) { // sep on right, so reverse the order
|
||||||
$title = $title . $prefix;
|
$title_array = explode( $t_sep, $title );
|
||||||
else
|
$title_array = array_reverse( $title_array );
|
||||||
$title = $prefix . $title;
|
$title = implode( " $sep ", $title_array ) . $prefix;
|
||||||
|
} else {
|
||||||
|
$title_array = explode( $t_sep, $title );
|
||||||
|
$title = $prefix . implode( " $sep ", $title_array );
|
||||||
|
}
|
||||||
|
|
||||||
$title = apply_filters('wp_title', $title, $sep, $seplocation);
|
$title = apply_filters('wp_title', $title, $sep, $seplocation);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user