single.php 752 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * The Template for displaying all single posts
  4. *
  5. * Methods for TimberHelper can be found in the /lib sub-directory
  6. *
  7. * @package WordPress
  8. * @subpackage Timber
  9. * @since Timber 0.1
  10. */
  11. $context = Timber::context();
  12. $timber_post = Timber::query_post();
  13. $context['post'] = $timber_post;
  14. $categories = get_the_terms( $id, 'category' );
  15. foreach ( $categories as $category ) {
  16. $cat = $category->slug;
  17. }
  18. $current_id[] = get_the_ID();
  19. $args = get_posts(array(
  20. 'post_type' => 'post',
  21. 'post_status' => 'publish',
  22. 'orderby' => 'date',
  23. 'order' => 'DESC',
  24. 'posts_per_page' => -1,
  25. 'category_name' => $cat,
  26. 'post__not_in' => $current_id,
  27. ));
  28. $context['other'] = $args;
  29. Timber::render('single.twig', $context );