I have 16 published posts of type "portfolio". With the query below, "found_posts" is 16. Correct so far.
I've set "posts_per_page" to -1 to see all of them. But only 8 of them get rendered. The wordpress setting posts per page is 10, so this cant be the issues. There is also no multilingual plugin like WPML working.
What am i doing wrong?
function portfolio_filter(){
$query = new WP_Query( array( 'posts_per_page' => -1,'post_status' => 'publish', 'post_type' => 'portfolio') );
$output = $query->found_posts; // Returns 16
if ( $query->have_posts() ) :
while ( $query->have_posts() ) {
$query->the_post();
$output.='<div class="entry filter_product">';
$output.=get_the_post_thumbnail($query->the_post()->ID,'medium');
$output.='<h3 class="title">'.get_the_title().'</h3>';
$output.='</div>';
}
wp_reset_postdata();
else :
//show 404 error here -->
endif;
return $output;
}