<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use Prodigy\Includes\Helpers\Prodigy_Url_Helper;

if ( $show_breadcrumbs ) :
	?>
	<nav>
		<ol class="prodigy-breadcrumbs prodigy-custom-template">
			<li class="prodigy-breadcrumbs__item">
				<a href="<?php echo esc_url( get_home_url() ); ?>"
					class="prodigy-breadcrumbs__item-link"
					rel="nofollow noopener"
					aria-label="<?php esc_attr_e( 'Visit Home page', 'prodigy-commerce' ); ?>"
				>
					<?php esc_html_e( 'home', 'prodigy-commerce' ); ?>
				</a>
			</li>
			<li class="prodigy-breadcrumbs__item-divider" aria-hidden="true" role="presentation"><span>/</span></li>
			<li class="prodigy-breadcrumbs__item">
				<a href="<?php echo esc_url( Prodigy_Url_Helper::prodigy_get_shop_url() ); ?>"
					class="prodigy-breadcrumbs__item-link"
					rel="nofollow noopener"
					aria-label="<?php esc_attr_e( 'Visit Shop page', 'prodigy-commerce' ); ?>"
				>
					<?php esc_html_e( 'shop', 'prodigy-commerce' ); ?>
				</a>
			</li>
			<?php if ( ! empty( $category ) ) : ?>
				<li class="prodigy-breadcrumbs__item-divider" aria-hidden="true" role="presentation"><span>/</span></li>
			<?php endif; ?>
			<?php if ( ! empty( $category ) ) : ?>
				<li class="prodigy-breadcrumbs__item">
					<a href="<?php echo esc_url( $link_to_category ); ?>"
						class="prodigy-breadcrumbs__item-link"
						rel="nofollow noopener"
						<?php /* translators: %s: category name */ ?>
						aria-label="<?php echo esc_attr( sprintf( __( 'Visit %s', 'prodigy-commerce' ), $category ) ); ?>"
					>
						<?php echo esc_html( mb_strtolower( $category ) ); ?>
					</a>
				</li>
			<?php endif; ?>
			<?php if ( ! empty( $style_curr_page ) && ! empty( $title ) ) : ?>
				<li class="prodigy-breadcrumbs__item-divider" aria-hidden="true" role="presentation"><span>/</span></li>
				<li class="prodigy-breadcrumbs__item" aria-current="page">
					<?php echo esc_html( $title ); ?>
				</li>
			<?php endif; ?>
		</ol>
	</nav>
	<?php
endif;
?>
