diff --git a/src/functions/breadcrumb.php b/src/functions/breadcrumb.php index ac122ae..aba18d4 100644 --- a/src/functions/breadcrumb.php +++ b/src/functions/breadcrumb.php @@ -104,10 +104,15 @@ function tainacan_interface_the_breadcrumb() { } } elseif ( is_attachment() ) { $parent = get_post($post->post_parent); - $cat = get_the_category($parent->ID); $cat = $cat[0]; - echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); - echo '' . $parent->post_title . ''; - if ($showCurrent == 1) echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after; + + $cat = get_the_category($parent->ID); + if ( !empty($cat) && is_array($cat) && count($cat) ) { + $cat = $cat[0]; + echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); + echo '' . $parent->post_title . ' ' . $delimiter; + } + if ($showCurrent == 1) + echo ' ' . $before . get_the_title() . $after; } elseif ( is_page() && !$post->post_parent ) { if ($showCurrent == 1) echo $before . get_the_title() . $after;