From 8990d8c02f04695662a4de6745715259b1fa4391 Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Mon, 18 Oct 2004 23:52:36 +0000 Subject: [PATCH] better fix for single_month_title, preserves backward-compatibility with git-svn-id: http://svn.automattic.com/wordpress/trunk@1816 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/template-functions-general.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index 3c3f6ae43..32c40ef42 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -216,15 +216,19 @@ function single_cat_title($prefix = '', $display = true ) { } function single_month_title($prefix = '', $display = true ) { - global $monthnum, $month, $year; - if(!empty($monthnum)) { + global $m, $monthnum, $month, $year; + if(!empty($monthnum) && !empty($year)) { $my_year = $year; $my_month = $month[$monthnum]; - if ($display) { - echo $prefix . $my_month . $prefix . " " . $my_year; - } else { - return $monthnum; - } + } elseif(!empty($m)) { + $my_year = substr($m, 0, 4); + $my_month = $month[substr($m, 4, 2)]; + } + + if (!empty($my_month) && $display) { + echo $prefix . $my_month . $prefix . $my_year; + } else { + return $monthnum; } }