From 77614fa3e1cf5171b7124dbf2921f334449e0cd5 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 28 Jul 2004 03:30:15 +0000 Subject: [PATCH] Fix wp_title() display of category_name. git-svn-id: https://develop.svn.wordpress.org/trunk@1492 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/template-functions-general.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index 3cedac1c22..3b4394a403 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -98,7 +98,7 @@ function get_bloginfo($show='') { function wp_title($sep = '»', $display = true) { 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(!empty($cat)) { @@ -107,6 +107,14 @@ function wp_title($sep = '»', $display = true) { } } 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'"); }