WordPress.org

Ready to get started?Download WordPress

Forums

To Alex K: # posts in month/category (11 posts)

  1. Cena
    Member
    Posted 10 years ago #

    Any chance you'll convert these 2 b2 hacks to WP?

  2. Mike Little
    Member
    Posted 10 years ago #

    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.
    Mike

  3. Alex King
    Member
    Posted 10 years ago #

    Awesome, thanks Mike!

  4. Cena
    Member
    Posted 10 years ago #

    Great! :)

  5. Alex Mills (Viper007Bond)
    Moderator
    Posted 10 years ago #

    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. :)

  6. Dougal Campbell
    Member
    Posted 10 years 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-last 1 turns on the counts
    <?php get_archives('','','html','','',1); ?>
    The last 1 turns on the counts
    We need to update the readme to reflect the new options...

  7. Cena
    Member
    Posted 10 years ago #

    Great, thanks dougal!

  8. Cena
    Member
    Posted 10 years ago #

    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!

  9. Dougal Campbell
    Member
    Posted 10 years ago #

    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.html

  10. Alex Mills (Viper007Bond)
    Moderator
    Posted 10 years ago #

    I was aware that counting for the months was a part of WordPress, but not categories. Thanks. :)

  11. cacophoney
    Member
    Posted 9 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.