Search code examples
wordpresstwigtimber

"post_per_page" not displaying the number of posts specified


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 Timber\Postquery($query);

$timber_post = new Timber\Post();
$context['post'] = $timber_post;
Timber::render( array( 'pages/page-' . $timber_post->post_name . '.twig', 'pages/page.twig' ), $context );


Solution

  • It should be posts_per_page, not post_per_page