mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Use get_query_var() in wp_title() and single_month_title().
git-svn-id: http://svn.automattic.com/wordpress/trunk@5003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c295c0bffe
commit
f774780aff
@ -156,8 +156,7 @@ function get_bloginfo($show='') {
|
|||||||
|
|
||||||
|
|
||||||
function wp_title($sep = '»', $display = true) {
|
function wp_title($sep = '»', $display = true) {
|
||||||
global $wpdb;
|
global $wpdb, $wp_locale, $wp_query;
|
||||||
global $m, $year, $monthnum, $day, $category_name, $wp_locale, $posts;
|
|
||||||
|
|
||||||
$cat = get_query_var('cat');
|
$cat = get_query_var('cat');
|
||||||
$p = get_query_var('p');
|
$p = get_query_var('p');
|
||||||
@ -165,6 +164,10 @@ function wp_title($sep = '»', $display = true) {
|
|||||||
$category_name = get_query_var('category_name');
|
$category_name = get_query_var('category_name');
|
||||||
$author = get_query_var('author');
|
$author = get_query_var('author');
|
||||||
$author_name = get_query_var('author_name');
|
$author_name = get_query_var('author_name');
|
||||||
|
$m = get_query_var('m');
|
||||||
|
$year = get_query_var('year');
|
||||||
|
$monthnum = get_query_var('monthnum');
|
||||||
|
$day = get_query_var('day');
|
||||||
$title = '';
|
$title = '';
|
||||||
|
|
||||||
// If there's a category
|
// If there's a category
|
||||||
@ -204,14 +207,14 @@ function wp_title($sep = '»', $display = true) {
|
|||||||
if ( !empty($year) ) {
|
if ( !empty($year) ) {
|
||||||
$title = $year;
|
$title = $year;
|
||||||
if ( !empty($monthnum) )
|
if ( !empty($monthnum) )
|
||||||
$title .= " $sep ".$wp_locale->get_month($monthnum);
|
$title .= " $sep " . $wp_locale->get_month($monthnum);
|
||||||
if ( !empty($day) )
|
if ( !empty($day) )
|
||||||
$title .= " $sep ".zeroise($day, 2);
|
$title .= " $sep " . zeroise($day, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a post
|
// If there is a post
|
||||||
if ( is_single() || is_page() ) {
|
if ( is_single() || is_page() ) {
|
||||||
$title = strip_tags($posts[0]->post_title);
|
$title = strip_tags($wp_query->get_queried_object()->post_title);
|
||||||
$title = apply_filters('single_post_title', $title);
|
$title = apply_filters('single_post_title', $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +267,12 @@ function single_cat_title($prefix = '', $display = true ) {
|
|||||||
|
|
||||||
|
|
||||||
function single_month_title($prefix = '', $display = true ) {
|
function single_month_title($prefix = '', $display = true ) {
|
||||||
global $m, $monthnum, $wp_locale, $year;
|
global $wp_locale;
|
||||||
|
|
||||||
|
$m = get_query_var('m');
|
||||||
|
$year = get_query_var('year');
|
||||||
|
$monthnum = get_query_var('monthnum');
|
||||||
|
|
||||||
if ( !empty($monthnum) && !empty($year) ) {
|
if ( !empty($monthnum) && !empty($year) ) {
|
||||||
$my_year = $year;
|
$my_year = $year;
|
||||||
$my_month = $wp_locale->get_month($monthnum);
|
$my_month = $wp_locale->get_month($monthnum);
|
||||||
|
Loading…
Reference in New Issue
Block a user