Kitsunechin
Kitsunechin

Reputation: 3

"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 );

Upvotes: 0

Views: 380

Answers (2)

Fatih Toprak
Fatih Toprak

Reputation: 1007

The right way : must be like posts_per_page args element.

Also you should use, Timber::get_posts($query) instead of Timber\Postquery($query);

Upvotes: 0

Ihar Aliakseyenka
Ihar Aliakseyenka

Reputation: 14183

It should be posts_per_page, not post_per_page

Upvotes: 1

Related Questions