Ancestor check

This commit is contained in:
Mike Jolley 2013-11-20 17:36:07 +00:00
parent 3acfc07684
commit 12bac47f85
1 changed files with 2 additions and 1 deletions

View File

@ -117,7 +117,8 @@ if ( ( ! is_home() && ! is_front_page() && ! ( is_post_type_archive() && get_opt
foreach ( $ancestors as $ancestor ) {
$ancestor = get_term( $ancestor, 'product_cat' );
echo $before . '<a href="' . get_term_link( $ancestor->slug, 'product_cat' ) . '">' . $ancestor->name . '</a>' . $after . $delimiter;
if ( ! is_wp_error( $ancestor ) && $ancestor )
echo $before . '<a href="' . get_term_link( $ancestor->slug, 'product_cat' ) . '">' . $ancestor->name . '</a>' . $after . $delimiter;
}
echo $before . '<a href="' . get_term_link( $main_term->slug, 'product_cat' ) . '">' . $main_term->name . '</a>' . $after . $delimiter;