To Alex K: # posts in month/category
-
Alex, Cena,
I’ve checked in this functionality to CVS now. No extra database query required 😉
It is off by default, but there is another parameter to the function to turn it on.
I’ve only done it for monthly but I guess weekly would make sense too. Maybe tonight.
MikeAwesome, thanks Mike!
Great! 🙂
Seems no one ever posted it. If you’re still interested in it, lemme know as I converted Alex’s awesome hack to work with WordPress a few hours ago. 🙂
There’s no hack needed. Support is already built into the system:
<?php list_cats(1,'All','ID','asc','',true,0,1,1); ?>
The next-to-last1
turns on the counts
<?php get_archives(”,”,’html’,”,”,1); ?>
The last1
turns on the counts
We need to update the readme to reflect the new options…Great, thanks dougal!
Okay, just for clarification:
Open up b2-include/b2template.functions.php :
To make # of posts in a category active, edit somewhere around lines 1069-1071, should look like this:
// out of the b2 loop
function list_cats($optionall = 1, $all = ‘All’, $sort_column = ‘ID’, $sort_order = ‘asc’,
$file = ‘blah’, $list = true, $optiondates = 0, $optioncount = , $hide_empty = 1) {
Set $optioncount=1.
To make # of posts in a month active, edit line 124:
function get_archives($type=”, $limit=”, $format=’html’, $before = “”, $after = “”, $show_post_count = false) {
Change $show_post_count to true.
Save, upload.
Works like a charm!Well, an easier way would be a leave b2template.functions.php alone, and just change the tags in your template.
BTW, I’ve updated the function documentionation for get_archives(), dropdown_cats(), and list_cats() in the CVS version of readme.htmlI was aware that counting for the months was a part of WordPress, but not categories. Thanks. 🙂
hullo people,
i prolly have to beg your pardon for being so stupid, but i know completely nothing about technical stuff..i currently have version 1.2.2; this hack (the one that displays number of posts each month) is exactly what i need, only i have no idea how to put it into my (archives) template. i use modified Nicer Archives, the one that only displays posts by date (not sortable).
i’ve searched all around and i have also tried suggestions posted above, but i cant seem to get it..
* where can i get the “b2template.functions.php” file? i dont have it since i use v.1.2.2
* what tag(s)/code/whatever should i add to my template to get it to work?
- The topic ‘To Alex K: # posts in month/category’ is closed to new replies.