Hi!
I want to make my Date Archives like this:
Feb 2005 (15) -- the number of posts
Jan 2005 (12)
Year 2004 (81)
Year 2003 (89)
...etc.
Is there a way to do it in WP?
Hi!
I want to make my Date Archives like this:
Feb 2005 (15) -- the number of posts
Jan 2005 (12)
Year 2004 (81)
Year 2003 (89)
...etc.
Is there a way to do it in WP?
Hm... I don't know if there's a better way to do this. If someone comes along and says there is, I'd use her or his method over this one since this involves editing the core.
But, here goes:
You need to edit 3 lines of wp-includes/template-functions-general.php
line 206
change
global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb;
to
global $querystring_start, $querystring_equal, $querystring_separator, $month, $month_abbrev, $wpdb;
line 252
change
$text = sprintf("%s %d", $month[zeroise($arcresult->month,2)], $arcresult->year);
to
$text = sprintf("%s %d", $month_abbrev[$month[zeroise($arcresult->month,2)]], $arcresult->year);
line 255
change
$text = sprintf("%s %d", $month[zeroise($arcresult->month,2)], $arcresult->year);
to
$text = sprintf("%s %d", $month_abbrev[$month[zeroise($arcresult->month,2)]], $arcresult->year);
This is all assuming you use version 1.2.2. If you use an earlier version, the changes, I think, are the same, but the line numbers may differ.
EDIT: That will get you your month abbreviations. To get the number of posts, all you have to do is use
<?php wp_get_archives('type=monthly&show_post_count=1'); ?>
in your index.php.
Tha would produce the list like
Feb 2005 (no. of posts)
Jan 2005 (no. of posts)
Dec 2004 (no. of posts)
But I want it like this:
Feb 2005 (no. of posts)
Jan 2005 (no. of posts)
Year 2004 (no. of posts)
Is there a way?!
Anyone?!
I have found what I was looking for and guess what there is a plugin for it too. WP rocks!!!
No plugin is necessary. All you had to do was go into template-functions-general.php and change
if (!isset($r['show_post_count'])) $r['show_post_count'] = false;
and
function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
to
if (!isset($r['show_post_count'])) $r['show_post_count'] = true;
and
function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = true) {
respectively.
This topic has been closed to new replies.