From 9110bfe34df1ba39de1ea085ef62172804eb9c5a Mon Sep 17 00:00:00 2001 From: "Jorge hangar.org" Date: Mon, 11 Apr 2022 01:59:39 +0200 Subject: [PATCH] categories show its own posts and not others --- archive.php | 7 +++---- template-parts/section-categoryposts.php | 19 ++++++------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/archive.php b/archive.php index 1b8a7c1..6c1b15a 100644 --- a/archive.php +++ b/archive.php @@ -30,12 +30,11 @@ endif; '10' ) ); - - elseif ( is_category( 'resources' ) ): - get_template_part( 'template-parts/section', 'categoryposts', array( 'category_name' => 'resources', 'post_per_page' => '10' ) ); + elseif ( is_category( 'news' ) ): + // get_template_part( 'template-parts/section', 'categoryposts', array( 'category_name' => 'news', 'post_per_page' => '3' ) ); + get_template_part( 'template-parts/section', 'categoryposts', array( 'post_per_page' => '3' ) ); elseif ( is_category( '' ) ): get_template_part( 'template-parts/section', 'categoryposts', array('post_per_page' => '6' ) ); diff --git a/template-parts/section-categoryposts.php b/template-parts/section-categoryposts.php index ae7e3b1..219eb1a 100644 --- a/template-parts/section-categoryposts.php +++ b/template-parts/section-categoryposts.php @@ -8,24 +8,18 @@ ?> - 'news', 'post_per_page' => '3' ) ); - $thiscategory = $args['category_name']; + // $thiscategory = $args['category_name']; $howmanyposts = $args['post_per_page']; -?> + $thiscategory = esc_html( get_the_category()[0]->name ); + ?>
-

- -

+

$thiscategory, 'posts_per_page' => $howmanyposts ) ); ?> @@ -70,4 +64,3 @@
-