Make WordPress Core


Ignore:
Timestamp:
10/28/2008 04:53:52 AM (17 years ago)
Author:
markjaquith
Message:

Make wp_title() sort titles based on separator direction. Reverse the titles in bundled theme. Better SEO. fixes #7338

File:
1 edited

Legend:

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

    r9356 r9376  
    377377    $day = get_query_var('day');
    378378    $title = '';
     379
     380    $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary
    379381
    380382    // If there's a category
     
    419421        $my_month = $wp_locale->get_month(substr($m, 4, 2));
    420422        $my_day = intval(substr($m, 6, 2));
    421         $title = "$my_year" . ($my_month ? "$sep $my_month" : "") . ($my_day ? "$sep $my_day" : "");
     423        $title = "$my_year" . ($my_month ? "$t_sep$my_month" : "") . ($my_day ? "$t_sep$my_day" : "");
    422424    }
    423425
     
    425427        $title = $year;
    426428        if ( !empty($monthnum) )
    427             $title .= " $sep " . $wp_locale->get_month($monthnum);
     429            $title .= "$t_sep" . $wp_locale->get_month($monthnum);
    428430        if ( !empty($day) )
    429             $title .= " $sep " . zeroise($day, 2);
     431            $title .= "$t_sep" . zeroise($day, 2);
    430432    }
    431433
     
    443445        $term = $wp_query->get_queried_object();
    444446        $term = $term->name;
    445         if ( 'right' == $seplocation )
    446             $title = "$term $sep $tax";
    447         else
    448             $title = "$tax $sep $term";
     447        $title = "$tax$t_sep$term";
    449448    }
    450449
     
    457456        $prefix = " $sep ";
    458457
    459     // Determines position of the separator
    460     if ( 'right' == $seplocation )
    461         $title = $title . $prefix;
    462     else
    463         $title = $prefix . $title;
     458    // Determines position of the separator and direction of the breadcrumb
     459    if ( 'right' == $seplocation ) { // sep on right, so reverse the order
     460        $title_array = explode( $t_sep, $title );
     461        $title_array = array_reverse( $title_array );
     462        $title = implode( " $sep ", $title_array ) . $prefix;
     463    } else {
     464        $title_array = explode( $t_sep, $title );
     465        $title = $prefix . implode( " $sep ", $title_array );
     466    }
    464467
    465468    $title = apply_filters('wp_title', $title, $sep, $seplocation);
Note: See TracChangeset for help on using the changeset viewer.