WordPress.org

Ready to get started?Download WordPress

Forums

category mesage counts (10 posts)

  1. drzeus
    Member
    Posted 10 years ago #

    Just wondering if anybody knows how to get the message count next to the categories on index.php.
    Thanks.

  2. Beel
    Member
    Posted 10 years ago #

    This has been posted often. If you do a search you will find both quick and dirty, as well as lengthy, responses. The quick and dirty is something like, <?php wp_list_cats(0, 'All', 'name', 'desc', '',1,0,1,1); ?>. The problem for me, however, is it is not working on my installation and I am still scratching my head trying to figure out why.

  3. Anonymous
    Unregistered
    Posted 10 years ago #

    Evidentally it is <?php list_cats(0, 'All', 'name', 'desc', '',1,0,1,1); ?>

  4. Cena
    Member
    Posted 10 years ago #

    In the new nightlies/CVS, list_cats has been replaced with wp_list_cats, and the 'old way' of setting up post/category counts no longer works.

  5. Ryan Boren
    WordPress Dev
    Posted 10 years ago #

    wp_list_cats() has a different calling convention. It uses named parameters rather than positional parameters. It takes one argument which is a string containing option names and their values. They are separated by '&', just like in a query string. For example, to enable counts do this:
    wp_lists_cats('optioncounts=1');
    To enable counts and dates:
    wp_lists_cats('optioncounts=1&optiondates=1');
    And so on. Add more options as needed, separating each key, value pair with an ampersand. You only need to specify the options you wish to change from the default.

  6. Ryan Boren
    WordPress Dev
    Posted 10 years ago #

    I just fixed some small bugs with the wp_list_cats() argument processing. Some options, such as optionall, would refuse to be set to 0. Fixed in CVS.

  7. ahlife
    Member
    Posted 8 years ago #

    May I ask, where to put this line:
    <?php list_cats(0, 'All', 'name', 'desc', '',1,0,1,1); ?>
    to get the category post counts displayed? Thanks!

  8. Michael Bishop

    Posted 8 years ago #

    Where do you want it? Most put it in sidebar.php but template tags can go in any of the theme's templates. index.php, home.php, single.php, etc.

  9. ahlife
    Member
    Posted 8 years ago #

    So according to your expanation, this display function only shows on those tamplates that I add this line in their sidebars? I will try it on my current template sidebar now and report back here if I succeed.
    Thank you!!

  10. Michael Bishop

    Posted 8 years ago #

    Generally speaking, all the templates load the sidebar, if the theme is the basic content/sidebar design. So adding it to sidebar.php, it should show on all the pages that contain the sidebar.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags