Home / category / Number of posts in a category
  • How to Number of posts in a category

    no thumbnail sorry: Number of posts in a category

    Adding this PHP code to your wordpress theme will display the total number of posts within the specified category.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    <?php
        $chosen_id = 5; // category number
        $thisCat = get_category($chosen_id);
        echo $thisCat->count;
    ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    get_category,
  • Anonymous

    Simple and sweet

  • Marcus N

    Good that you wrote this, and that I found it! Thanx.