Post Count // gets the number of posts. $post_count = $GLOBALS['wp_query']->post_count; Source: https://wordpress.stackexchange.com/a/134975/14380