Advertisement
salmancreation

How to Number of posts in a category

Aug 5th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.27 KB | None | 0 0
  1.  
  2. How to Number of posts in a category
  3.  
  4. Adding this PHP code to your wordpress theme will display the total number of posts within the specified category.
  5. <?php
  6.     $chosen_id = 5; // category number
  7.     $thisCat = get_category($chosen_id);
  8.     echo $thisCat->count;
  9. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement