Allow optiondates to be a PHP date() formatted timestamp, maintains backward compatibility. git-svn-id: http://svn.automattic.com/wordpress/trunk@1931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d5c7cc229e
commit
5237112e3f
|
@ -327,17 +327,14 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intval($optiondates) == 1) {
|
if ( $optiondates ) {
|
||||||
$cat_dates = $wpdb->get_results(" SELECT cat_ID,
|
$cat_dates = $wpdb->get_results(" SELECT category_id,
|
||||||
DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth
|
UNIX_TIMESTAMP( MAX(post_date) ) AS ts
|
||||||
FROM $wpdb->categories
|
FROM $wpdb->posts, $wpdb->post2cat
|
||||||
LEFT JOIN $wpdb->post2cat ON (cat_ID = category_id)
|
WHERE post_status = 'publish' AND post_id = ID $exclusions
|
||||||
LEFT JOIN $wpdb->posts ON (ID = post_id)
|
|
||||||
WHERE post_status = 'publish' $exclusions
|
|
||||||
GROUP BY category_id");
|
GROUP BY category_id");
|
||||||
foreach ($cat_dates as $cat_date) {
|
foreach ($cat_dates as $cat_date) {
|
||||||
$category_lastday["$cat_date->cat_ID"] = $cat_date->lastday;
|
$category_timestamp["$cat_date->category_id"] = $cat_date->ts;
|
||||||
$category_lastmonth["$cat_date->cat_ID"] = $cat_date->lastmonth;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,8 +398,9 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||||
if (intval($optioncount) == 1) {
|
if (intval($optioncount) == 1) {
|
||||||
$link .= ' ('.intval($category_posts["$category->cat_ID"]).')';
|
$link .= ' ('.intval($category_posts["$category->cat_ID"]).')';
|
||||||
}
|
}
|
||||||
if (intval($optiondates) == 1) {
|
if ( $optiondates ) {
|
||||||
$link .= ' '.$category_lastday["$category->cat_ID"].'/'.$category_lastmonth["$category->cat_ID"];
|
if ( $optiondates == 1 ) $optiondates = 'Y-m-d';
|
||||||
|
$link .= ' ' . gmdate($optiondates, $category_timestamp["$category->cat_ID"]);
|
||||||
}
|
}
|
||||||
if ($list) {
|
if ($list) {
|
||||||
$thelist .= "\t<li>$link\n";
|
$thelist .= "\t<li>$link\n";
|
||||||
|
|
Loading…
Reference in New Issue