“WP Get_Results Count” Kode Jawaban

Hitungan item WP_QUERY

<?php $count = $custom_posts->found_posts; ?>
Wandering Walrus

Hasil Hitung WP_Query

$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"; 
gtamborero

WP Get_Results Count

global $wpdb;
$wpdb->get_results("
	-- YOUR QUERY
                "); 
-- get_results IT RETURNS AN ARRAY IF QUERY HAS 1 OR MORE ROWS
echo $wpdb->num_rows;
Enrybi

Jawaban yang mirip dengan “WP Get_Results Count”

Pertanyaan yang mirip dengan “WP Get_Results Count”

Lebih banyak jawaban terkait untuk “WP Get_Results Count” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya