2011/06/03

Change archive date format - wordpress 3.1.2

Cannot believe it, but I could not find it in the dashboard to change archive date format. The wordpress I have installed is English version 3.1.2, and date format of archive is "mY", like "June 2011". If you like to show it as 2011 June, beside writing your own get archive function, only thing you can do I think is change source code. I know it is very bad idea, but anyway, if you have to change the formate, here is the solution, Go to "/wp-include/general-template.php", find this line,
$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
And change it to
$text = sprintf(__('%2$d %1$s'), $wp_locale->get_month($arcresult->month), $arcresult->year);
 
If you also want to change the date formate on archive page title, then find this line,
$result = $prefix . $my_month . $prefix . $my_year;
And change it to
$result = $prefix . $my_year . $prefix . $my_month;

No comments:

Post a Comment