Make WordPress Core


Ignore:
Timestamp:
04/26/2004 11:54:52 PM (20 years ago)
Author:
saxmatt
Message:

Reducing queries and forward thinking database fields.

File:
1 edited

Legend:

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

    r1157 r1185  
    9393function wp_title($sep = '»', $display = true) {
    9494    global $wpdb, $tableposts, $tablecategories;
    95     global $year, $monthnum, $day, $cat, $p, $name, $month;
     95    global $year, $monthnum, $day, $cat, $p, $name, $month, $posts, $single;
    9696
    9797    // If there's a category
     
    123123
    124124    // If there's a post
    125     if (intval($p) || '' != $name) {
    126         if (!$p) {
    127         if ($year != '') {
    128             $year = '' . intval($year);
    129             $where .= ' AND YEAR(post_date)=' . $year;
    130         }
    131        
    132         if ($monthnum != '') {
    133             $monthnum = '' . intval($monthnum);
    134             $where .= ' AND MONTH(post_date)=' . $monthnum;
    135         }
    136        
    137         if ($day != '') {
    138             $day = '' . intval($day);
    139             $where .= ' AND DAYOFMONTH(post_date)=' . $day;
    140         }
    141             $p = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_name = '$name' $where");
    142         }
    143         $post_data = get_postdata($p);
    144         $title = strip_tags(stripslashes($post_data['Title']));
     125    if ($single) {
     126        $title = strip_tags(stripslashes($posts[0]->post_title));
    145127        $title = apply_filters('single_post_title', $title);
    146128    }
Note: See TracChangeset for help on using the changeset viewer.