WordPress.org

Make WordPress Core

Changeset 5003


Ignore:
Timestamp:
03/09/2007 04:06:23 AM (11 years ago)
Author:
ryan
Message:

Use get_query_var() in wp_title() and single_month_title().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r4990 r5003  
    157157
    158158function wp_title($sep = '»', $display = true) {
    159     global $wpdb;
    160     global $m, $year, $monthnum, $day, $category_name, $wp_locale, $posts;
     159    global $wpdb, $wp_locale, $wp_query;
    161160
    162161    $cat = get_query_var('cat');
     
    166165    $author = get_query_var('author');
    167166    $author_name = get_query_var('author_name');
     167    $m = get_query_var('m');
     168    $year = get_query_var('year');
     169    $monthnum = get_query_var('monthnum');
     170    $day = get_query_var('day');
    168171    $title = '';
    169172
     
    205208        $title = $year;
    206209        if ( !empty($monthnum) )
    207             $title .= " $sep ".$wp_locale->get_month($monthnum);
     210            $title .= " $sep " . $wp_locale->get_month($monthnum);
    208211        if ( !empty($day) )
    209             $title .= " $sep ".zeroise($day, 2);
     212            $title .= " $sep " . zeroise($day, 2);
    210213    }
    211214
    212215    // If there is a post
    213216    if ( is_single() || is_page() ) {
    214         $title = strip_tags($posts[0]->post_title);
     217        $title = strip_tags($wp_query->get_queried_object()->post_title);
    215218        $title = apply_filters('single_post_title', $title);
    216219    }
     
    265268
    266269function single_month_title($prefix = '', $display = true ) {
    267     global $m, $monthnum, $wp_locale, $year;
     270    global $wp_locale;
     271
     272    $m = get_query_var('m');
     273    $year = get_query_var('year');
     274    $monthnum = get_query_var('monthnum');
     275
    268276    if ( !empty($monthnum) && !empty($year) ) {
    269277        $my_year = $year;
Note: See TracChangeset for help on using the changeset viewer.