I am looking to list the number of posts and comments outside the loop, specifically in a "page." I've got the php-exec plugin installed, now all I need is a tag. Surly there is one because it displays on the dashboard. Anyone know what it is?
I am looking to list the number of posts and comments outside the loop, specifically in a "page." I've got the php-exec plugin installed, now all I need is a tag. Surly there is one because it displays on the dashboard. Anyone know what it is?
You can look at the code for the Admin dashboard by looking at: your_site/wp-admin/index.php in your favorite editor to see how it's done.
It uses SQL queries to return the counts for posts, comments, and categories. I don't believe there are any tags to return this data, but I think there are plugins to accomplish what you are looking for.
ex:
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
This topic has been closed to new replies.