Skip to content

Instantly share code, notes, and snippets.

@jarednova
Last active December 22, 2015 11:19
Show Gist options
  • Save jarednova/6464926 to your computer and use it in GitHub Desktop.
Save jarednova/6464926 to your computer and use it in GitHub Desktop.
<?php
$data = Timber::get_context();
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('posts_per_page=2&paged='.$paged);
$posts = Timber::get_posts();
$data['posts'] = $posts;
$data['pagination'] = Timber::get_pagination();
Timber::render('date.twig', $data);
@jarednova
Copy link
Author

So get_pagination() relies on using the current query. Even though you're sending new data to Timber::get_posts(); the original query is unaffected.

To modify that query you just need to send query_posts the new info (which modifies the WP loop). In a future release I'll make it so this happens automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment