Answers for "wp_query count result"

PHP
0

wp_query item count

<?php $count = $custom_posts->found_posts; ?>
Posted by: Guest on October-23-2020
0

wp_query count result

$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";
Posted by: Guest on March-19-2022

Browse Popular Code Answers by Language