Fix wp_title() display of category_name.

git-svn-id: https://develop.svn.wordpress.org/trunk@1492 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2004-07-28 03:30:15 +00:00
parent fdaf705b04
commit 77614fa3e1
1 changed files with 9 additions and 1 deletions

View File

@ -98,7 +98,7 @@ function get_bloginfo($show='') {
function wp_title($sep = '»', $display = true) { function wp_title($sep = '»', $display = true) {
global $wpdb; global $wpdb;
global $m, $year, $monthnum, $day, $cat, $p, $name, $month, $posts; global $m, $year, $monthnum, $day, $cat, $category_name, $p, $name, $month, $posts;
// If there's a category // If there's a category
if(!empty($cat)) { if(!empty($cat)) {
@ -107,6 +107,14 @@ function wp_title($sep = '»', $display = true) {
} }
} }
if (!empty($category_name)) { if (!empty($category_name)) {
if (stristr($category_name,'/')) {
$category_name = explode('/',$category_name);
if ($category_name[count($category_name)-1]) {
$category_name = $category_name[count($category_name)-1]; // no trailing slash
} else {
$category_name = $category_name[count($category_name)-2]; // there was a trailling slash
}
}
$title = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'"); $title = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'");
} }