Skip to content

Instantly share code, notes, and snippets.

@jarednova
Last active August 29, 2015 14:14
Show Gist options
  • Save jarednova/38371080e115c14e8e19 to your computer and use it in GitHub Desktop.
Save jarednova/38371080e115c14e8e19 to your computer and use it in GitHub Desktop.
$post = new TimberPost();
$context['post'] = $post;
$category = $post->category(); // this will be a TimberTerm assuming there's 1 or more category assigned to this post
$query = array('posts_per_page' => 6, 'cat' => $category->ID, 'post__not_in' => array($post->ID));
$context['latest'] = Timber::get_posts($query);
//the rest as you had it in your gist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment