From 3c83424737c133cce7acc6a6c6d93f9496898f5f Mon Sep 17 00:00:00 2001 From: Patrick McNeil Date: Thu, 7 Dec 2023 17:18:52 -0500 Subject: [PATCH] Update Functions.php Fixes a bug where an error message is output in the breadcrumbs when visiting a taxonomy archive page with no published posts tagged with that taxonomy. --- libs/Functions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/Functions.php b/libs/Functions.php index 4d52963ed..3a5fc9a33 100644 --- a/libs/Functions.php +++ b/libs/Functions.php @@ -1527,8 +1527,11 @@ public function breadcrumbs($options=array()){ } } } elseif ( !is_single() && !is_page() && get_post_type() !== 'post' && !is_404() ){ - $post_type = get_post_type_object(get_post_type()); - echo $data['before'] . '' . $post_type->labels->name . '' . $data['after']; + if( $post_type = get_post_type_object( get_post_type() ) ){ + echo $data['before'] . '' . $post_type->labels->name . '' . $data['after']; + }else{ + echo $data['before'] . get_queried_object()->name . $data['after']; + } } elseif ( is_attachment() ){ //@TODO "Nebula" 0: Check for gallery pages? If so, it should be Home > Parent(s) > Gallery > Attachment if ( !empty($post->post_parent) ){ //@TODO "Nebula" 0: What happens if the page parent is a child of another page? echo '
  • ' . strip_tags(get_the_title($post->post_parent)) . '
  • ' . $data['delimiter_html'] . ' ' . strip_tags(get_the_title());