From 82ce1240f0ab2717dd948f7af83c3ac4ffdfdd48 Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 29 Jul 2023 03:03:18 -0500 Subject: [PATCH] enhance(crumb): Add child categories to breadcrumb (Fixes #4) (#12) --- src/Crumb.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Crumb.php b/src/Crumb.php index a47324d..9349722 100644 --- a/src/Crumb.php +++ b/src/Crumb.php @@ -189,14 +189,14 @@ public function build() $categories = get_the_category(get_the_ID()); if (! empty($categories)) { - $category = array_shift($categories); - - $this->add( - $category->name, - get_category_link($category), - $category->term_id, - true - ); + foreach ($categories as $index => $category) { + $this->add( + $category->name, + get_category_link($category), + $category->term_id, + $index === 0 + ); + } return $this->add( get_the_title(),