WordPress.org

Ready to get started?Download WordPress

Forums

Number of Posts (3 posts)

  1. horizon1976
    Member
    Posted 9 years ago #

    I would like to know how I would show the number of posts of each category next to the category name on the front page.

  2. c0y0te
    Member
    Posted 9 years ago #

    I did something like this myself a few days ago. I was concerned with the alphabetical listing of the categories so I used this fix to correct the issue. I threw up a quick tutorials to help folks at my blog as follows:-

    http://www.avalon5.com/index.php/archives/41

    The syntax of the calling PHP also delivers the post count per category. In addition if you want the same functionality on archives use the following:-

    Replace the code

    <?php wp_get_archives('type=monthly'); ?>

    with

    <?php get_archives('monthly', '', 'html', '', '', TRUE); ?>

    That's what worked for me. Hope it helps. If you need any help or have any questions on the tutorial - drop me a line at my blog and I'll get back to you. Good luck.

    Coyote

  3. Kafkaesqui

    Posted 9 years ago #

    horizon1976: See the information on the optioncount parameter for the category list template tags:

    http://codex.wordpress.org/Template_Tags/list_cats
    http://codex.wordpress.org/Template_Tags/wp_list_cats

    coyote: Both get_archives() and wp_get_archives() can be set to display the post count, so there's no need to switch from one to the other. See the show_post_count parameter for both:

    http://codex.wordpress.org/Template_Tags/get_archives
    http://codex.wordpress.org/Template_Tags/wp_get_archives

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.