' . esc_html( get_the_title( $ancestor ) ) . '';
++$position;
}
}
$breadcrumb .= '' . esc_html( get_the_title( $post_id ) ) . '';
} elseif ( $is_taxonomy_hierarchical ) {
$current = get_term( get_queried_object_id(), $taxonomy );
if ( is_wp_error( $current ) ) {
return;
}
if ( $current->parent ) {
$breadcrumb = jetpack_get_term_parents( $current->parent, $taxonomy );
}
$breadcrumb .= '' . esc_html( $current->name ) . '';
}
$home = '' . esc_html__( 'Home', 'jetpack' ) . '';
echo ''; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
if ( ! function_exists( 'jetpack_get_term_parents' ) ) {
/**
* Return the parents for a given taxonomy term ID.
*
* @phan-suppress PhanRedefineFunction -- Covered by function_exists check.
*
* @param int $term Taxonomy term whose parents will be returned.
* @param string $taxonomy Taxonomy name that the term belongs to.
* @param array $visited Terms already added to prevent duplicates.
*
* @return string A list of links to the term parents.
*/
function jetpack_get_term_parents( $term, $taxonomy, $visited = array() ) {
_deprecated_function( __FUNCTION__, 'jetpack-13.8' );
$parent = get_term( $term, $taxonomy );
if ( is_wp_error( $parent ) ) {
return $parent;
}
$chain = '';
if ( $parent->parent && ( $parent->parent !== $parent->term_id ) && ! in_array( $parent->parent, $visited, true ) ) {
$visited[] = $parent->parent;
$chain .= jetpack_get_term_parents( $parent->parent, $taxonomy, $visited );
}
$chain .= '' . $parent->name . '';
return $chain;
}
}
}