wp_query chount
<?php $count = $custom_posts->found_posts; ?>
Wandering Walrus
<?php $count = $custom_posts->found_posts; ?>
$args = array('post_type' => 'post',
'posts_per_page' => '4',
'paged' => $pagination);
$posts = new \WP_Query( $args );
echo $posts->post_count; // echo number of posts on query
// If you what to know if you arrived to pagination end then:
if ($posts->max_num_pages == $pagination) echo "You are on an end page";
global $wpdb;
$wpdb->get_results("
-- YOUR QUERY
");
-- get_results IT RETURNS AN ARRAY IF QUERY HAS 1 OR MORE ROWS
echo $wpdb->num_rows;