I have an issue with displaying the desired number of posts per page. I tried changing the number of specified posts ‘post_per_page’ => ‘3’ but the result are still the same number of 4 posts. In the twig file I am just outputting the result with a simple loop statement: {% for project in projects %}
$context = Timber::context();
$query = array(
'post_type' => 'project',
'post_per_page' => '3'
);
$context['projects'] = new TimberPostquery($query);
$timber_post = new TimberPost();
$context['post'] = $timber_post;
Timber::render( array( 'pages/page-' . $timber_post->post_name . '.twig', 'pages/page.twig' ), $context );
2
Answers
It should be
posts_per_page
, not post_per_pageThe right way : must be like
posts_per_page
args element.Also you should use,
Timber::get_posts($query)
instead ofTimberPostquery($query)
;