Skip to content

Instantly share code, notes, and snippets.

@thom4parisot
Created May 23, 2010 12:28
Show Gist options
  • Save thom4parisot/410893 to your computer and use it in GitHub Desktop.
Save thom4parisot/410893 to your computer and use it in GitHub Desktop.
WordPress − Returns the number of candidate posts for the current query
<?php
/**
* Returns the number of candidate posts for the current query
*
* Written because I saw some heavy code like that to do the same thing: http://theandystratton.com/2009/show-total-search-results-wordpress-search-template/
*
* @version 1.0
* @since 2010-05-23
* @author Oncle Tom <http://case.oncle-tom.net>
* @return integer Number of posts found
*/
function get_found_posts_count()
{
global $wp_query;
return $wp_query->found_posts;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment