Drop Down Category count and Alphabetizing (5 posts)

  1. southerngal
    Posted 12 years ago #

    I found this post on the b2 boards, but it doesn't look like the same code that I have in my WP b2template.functions.php http://www.tidakada.com/board/viewtopic.php?t=1110
    What I would like to do is show the categories alphabetized and a number for how many posts are in each category.
    I am using the drop-down categories, not the list.
    Is there a way to do this?
    If you would please also tell me how to show the category count for the list, I have how to alphabetize that already.
    Thanks! :)

  2. Mike Little
    Posted 12 years ago #

    Oops sorry, I didn't give any explanation.
    This code is to completely replace the dropdown_cats function in b2template.functions.php (in my version it is round about line 870)
    You are right about the curly quotes.
    try here http://zed1.com/dropdown_cats.php.html

  3. southerngal
    Posted 12 years ago #

    Hi Mike, thanks for putting that at a download site. :) I think I have it in the right place as there aren't any errors.
    I used this code to call it in: <form action="<?php echo $PHP_SELF ?>" method="get">
    <?php dropdown_cats("0") ?>
    <input class="button" type="submit" value="View!" />
    It just has the categories, not in alphabetical order and no count on there either. Maybe I did something wrong or need to go through the code and specify things?

  4. Mike Little
    Posted 12 years ago #

    Sorry, the parameters need to be specified in your call to dropdown_cats() to turn the different things on, so:
    dropdown_cats(1, 'All Categories', 'name', 'asc', 0, 1, 1 );
    will give you the 'all' option, with the name 'All Categories', sorted by name, ascending, with no date, but with post count, and empty categories supressed.

  5. southerngal
    Posted 12 years ago #

    Omg, thanks Mike, it worked like a charm! :)

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.