Fixes breadcrum issue on attachment pages.

This commit is contained in:
mateuswetah 2021-07-30 09:45:56 -03:00
parent ea6aa13f2f
commit b89beae146
1 changed files with 9 additions and 4 deletions

View File

@ -104,10 +104,15 @@ function tainacan_interface_the_breadcrumb() {
} }
} elseif ( is_attachment() ) { } elseif ( is_attachment() ) {
$parent = get_post($post->post_parent); $parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID); $cat = $cat[0];
echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); $cat = get_the_category($parent->ID);
echo '<a href="' . esc_url(get_permalink($parent)) . '">' . $parent->post_title . '</a>'; if ( !empty($cat) && is_array($cat) && count($cat) ) {
if ($showCurrent == 1) echo '&nbsp;' . $delimiter . '&nbsp;' . $before . get_the_title() . $after; $cat = $cat[0];
echo get_category_parents($cat, TRUE, '&nbsp;' . $delimiter . '&nbsp;');
echo '<a href="' . esc_url(get_permalink($parent)) . '">' . $parent->post_title . '</a>&nbsp;' . $delimiter;
}
if ($showCurrent == 1)
echo '&nbsp;' . $before . get_the_title() . $after;
} elseif ( is_page() && !$post->post_parent ) { } elseif ( is_page() && !$post->post_parent ) {
if ($showCurrent == 1) echo $before . get_the_title() . $after; if ($showCurrent == 1) echo $before . get_the_title() . $after;