[wp-cvs] wordpress/wp-includes template-functions-category.php, 1.42, 1.43

Matthew Mullenweg saxmatt at users.sourceforge.net
Thu Dec 9 01:30:37 UTC 2004


Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14736/wp-includes

Modified Files:
	template-functions-category.php 
Log Message:
Related to: http://mosquito.wordpress.org/view.php?id=225

Allow optiondates to be a PHP date() formatted timestamp, maintains backward compatibility.

Index: template-functions-category.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions-category.php,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** template-functions-category.php	3 Dec 2004 02:38:11 -0000	1.42
--- template-functions-category.php	9 Dec 2004 01:30:34 -0000	1.43
***************
*** 328,342 ****
  	}
  	
! 	if (intval($optiondates) == 1) {
! 		$cat_dates = $wpdb->get_results("	SELECT cat_ID,
! 		DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth
! 		FROM $wpdb->categories 
! 		LEFT JOIN $wpdb->post2cat ON (cat_ID = category_id)
! 		LEFT JOIN $wpdb->posts ON (ID = post_id)
! 		WHERE post_status = 'publish' $exclusions
  		GROUP BY category_id");
  		foreach ($cat_dates as $cat_date) {
! 			$category_lastday["$cat_date->cat_ID"] = $cat_date->lastday;
! 			$category_lastmonth["$cat_date->cat_ID"] = $cat_date->lastmonth;
  		}
  	}
--- 328,339 ----
  	}
  	
! 	if ( $optiondates ) {
! 		$cat_dates = $wpdb->get_results("	SELECT category_id,
! 		UNIX_TIMESTAMP( MAX(post_date) ) AS ts
! 		FROM $wpdb->posts, $wpdb->post2cat
! 		WHERE post_status = 'publish' AND post_id = ID $exclusions
  		GROUP BY category_id");
  		foreach ($cat_dates as $cat_date) {
! 			$category_timestamp["$cat_date->category_id"] = $cat_date->ts;
  		}
  	}
***************
*** 402,407 ****
  				$link .= ' ('.intval($category_posts["$category->cat_ID"]).')';
  			}
! 			if (intval($optiondates) == 1) {
! 				$link .= ' '.$category_lastday["$category->cat_ID"].'/'.$category_lastmonth["$category->cat_ID"];
  			}
  			if ($list) {
--- 399,405 ----
  				$link .= ' ('.intval($category_posts["$category->cat_ID"]).')';
  			}
! 			if ( $optiondates ) {
! 				if ( $optiondates == 1 ) $optiondates = 'Y-m-d';
! 				$link .= ' ' . gmdate($optiondates, $category_timestamp["$category->cat_ID"]);
  			}
  			if ($list) {




More information about the cvs mailing list