I need a function to calculate the number of posts in a WordPress blog that you know if you have a category Looking at the blog or the entire blog
I am eager to avoid writing a different way for every different situation and want to make sure that I get off on a reliable path.
Thanks
If you want to retrieve all the posts in a blog Count, Use To get a count of the rank from a specific category, count on a call with the category id specified as a parameter ().
Example:
& lt; Php $ posts = get_posts ('category = 1'); $ Count = count ($ post); Echo $ count; ? & Gt; Unfortunately the WordPress' wp_count_posts () function will not count posts in a category. It will only calculate the custom post types in different post types, such as posts, pages, drafts, and 3.0.
Comments
Post a Comment