Make WordPress Core

Changeset 5009


Ignore:
Timestamp:
03/09/2007 08:47:52 PM (19 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

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

    r4775 r5009  
    148148
    149149function wp_title($sep = '»', $display = true) {
    150         global $wpdb;
    151         global $m, $year, $monthnum, $day, $category_name, $wp_locale, $posts;
     150        global $wpdb, $wp_locale, $wp_query;
    152151
    153152        $cat = get_query_var('cat');
     
    157156        $author = get_query_var('author');
    158157        $author_name = get_query_var('author_name');
     158        $m = get_query_var('m');
     159        $year = get_query_var('year');
     160        $monthnum = get_query_var('monthnum');
     161        $day = get_query_var('day');
    159162        $title = '';
    160163
     
    197200                $title = $year;
    198201                if ( !empty($monthnum) )
    199                         $title .= " $sep ".$wp_locale->get_month($monthnum);
     202                        $title .= " $sep " . $wp_locale->get_month($monthnum);
    200203                if ( !empty($day) )
    201                         $title .= " $sep ".zeroise($day, 2);
     204                        $title .= " $sep " . zeroise($day, 2);
    202205        }
    203206
    204207        // If there is a post
    205208        if ( is_single() || is_page() ) {
    206                 $title = strip_tags($posts[0]->post_title);
     209                $title = strip_tags($wp_query->get_queried_object()->post_title);
    207210                $title = apply_filters('single_post_title', $title);
    208211        }
     
    257260
    258261function single_month_title($prefix = '', $display = true ) {
    259         global $m, $monthnum, $wp_locale, $year;
     262        global $wp_locale;
     263
     264        $m = get_query_var('m');
     265        $year = get_query_var('year');
     266        $monthnum = get_query_var('monthnum');
     267
    260268        if ( !empty($monthnum) && !empty($year) ) {
    261269                $my_year = $year;
Note: See TracChangeset for help on using the changeset viewer.