<?php
/**
 * Breadcrumb template part.
 *
 * @package Fragrance_Trade
 *
 * @param array $items  Array of ['label' => string, 'url' => string|null].
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}


if ( empty( $args['items'] ) || ! is_array( $args['items'] ) ) {
	return;
}
?>
<nav class="breadcrumb-nav mb-4" aria-label="<?php esc_attr_e( '面包屑导航', 'fragrance-trade' ); ?>">
	<?php
	$count = count( $args['items'] );
	$i     = 1;
	foreach ( $args['items'] as $item ) :
		$is_last = ( $i === $count );
		if ( ! empty( $item['url'] ) && ! $is_last ) :
			?>
			<a href="<?php echo esc_url( $item['url'] ); ?>"><?php echo esc_html( $item['label'] ); ?></a>
			<?php if ( ! $is_last ) : ?>
				<span aria-hidden="true"> / </span>
			<?php endif; ?>
			<?php
		else :
			?>
			<span><?php echo esc_html( $item['label'] ); ?></span>
			<?php
		endif;
		++$i;
	endforeach;
	?>
</nav>
