Interesting challenge. I was given a piece of code earlier, which I have modified as follows for the Posts page.
/* add time stamp */
add_filter('manage_posts_columns', 'posts_columns', 5);
function posts_columns($defaults){
$defaults['your_date_col'] = __('Date');
$defaults['week_number'] = __('Wk#');
$defaults['week_in_quarter'] = __('Wk/Qtr');
return $defaults;
}
add_action('manage_posts_custom_column', 'posts_custom_columns', 5, 2);
function posts_custom_columns($column_name, $id){
if($column_name === 'your_date_col'){
echo the_date('d M'),' ',the_time('Ha');
}
if($column_name === 'week_number'){
echo 'Here: ',the_date();
}
}
Strangely, although the date format that I have given shows up in the first column ("your_date_col"), only "Here: " shows up in the second column ("week_number"). Any suggestions as to why the_date function doesn't work in the second column?
the_date()to always behave strangely, I believe there's a note about it in the codex. I useget_the_date()orthe_time()instead. – Milo Jun 3 '11 at 20:06