fix other post pSingle

This commit is contained in:
2020-05-29 11:45:55 +02:00
parent db9bb066cd
commit 919cc086b9
4 changed files with 26 additions and 15 deletions
+18 -1
View File
@@ -13,6 +13,23 @@ $context = Timber::context();
$timber_post = Timber::query_post();
$context['post'] = $timber_post;
$context['posts'] = get_posts();
$categories = get_the_terms( $id, 'category' );
foreach ( $categories as $category ) {
$cat = $category->slug;
}
$current_id[] = get_the_ID();
$args = get_posts(array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => -1,
'category_name' => $cat,
'post__not_in' => $current_id,
));
$context['other'] = $args;
Timber::render('single.twig', $context );