Support » How-To and Troubleshooting » Drop Down Category count and Alphabetizing

Drop Down Category count and Alphabetizing

  • 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! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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

    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?

    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.

    Omg, thanks Mike, it worked like a charm! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Drop Down Category count and Alphabetizing’ is closed to new replies.