Plugin Directory

Count Posts

Changes

1.0

  1. Initial release.

Count Posts Function

The Count Posts function can be called anywhere in a WordPress template and has three variables:

count_posts($category, $daysago, $display)

$category

The $category variable is used to count the number of posts in a category (or Term in WordPress 2.5 or greater). Simply put the name of your category in the function call e.g.

count_posts('mycategory')

If it is left blank, which is the default, the function will count post in all categories.

$daysago

The $daysago variable is used to count the number of posts from a specified number of days ago e.g.

count_posts('mycategory', '8')

If it is left blank or set to 0, the default, the function will count all posts.

$display

The $display variable is used to either output the count number or to return it.

count_posts('mycategory', '8', true)

If it is left blank or set to true, the default, the function will output the number of posts to the page. If it is set to false, the function will return the number.

Known Issues

No known issues at this time.

If you find any bugs or want to request some additional features for future releases, please log them the projects tracker page

Download

FYI

Compatibility beta

Your Setup

Log in to vote.

The Consensus

No data

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(2 ratings)