<?php
	if ( ! defined( 'ABSPATH' ) ) {
		exit;
	}

	$sep = ' › ';

	if ( is_front_page() ) {
		return;
	}
?>
<div class="g-b24e2866">
	<nav class="breadcrumbs g-a7fcd570" aria-label="Breadcrumbs">
		<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
			<?php echo esc_html( get_bloginfo( 'name' ) ); ?>
		</a>
		<?php if ( is_category() ) : ?>
			<span class="breadcrumbs-separator"><?php echo esc_html( $sep ); ?></span>
			<span class="breadcrumbs-current">
				<?php single_cat_title(); ?>
			</span>
		<?php elseif ( is_tag() ) : ?>
			<span class="breadcrumbs-separator"><?php echo esc_html( $sep ); ?></span>
			<span class="breadcrumbs-current">
				<?php single_tag_title(); ?>
			</span>
		<?php elseif ( is_single() ) : ?>
			<?php
			$categories = get_the_category();

			if ( ! empty( $categories ) ) :
				?>
				<span class="breadcrumbs-separator">
					<?php echo esc_html( $sep ); ?>
				</span>
				<?php foreach ( $categories as $key => $category ) : ?>
				<a href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>">
					<?php echo esc_html( $category->name ); ?>
				</a>
				<?php if ( $key < count( $categories ) - 1 ) : ?>
					<span class="breadcrumbs-divider"> / </span>
				<?php endif; ?>
			<?php endforeach; ?>
			<?php endif; ?>
			<span class="breadcrumbs-separator">
				<?php echo esc_html( $sep ); ?>
			</span>
			<span class="breadcrumbs-current">
				<?php the_title(); ?>
			</span>
		<?php elseif ( is_page() ) : ?>
			<span class="breadcrumbs-separator">
				<?php echo esc_html( $sep ); ?>
			</span>
			<span class="breadcrumbs-current">
				<?php the_title(); ?>
			</span>
		<?php elseif ( is_home() ) : ?>
			<?php
			$page_for_posts_id = get_option( 'page_for_posts' );

			if ( $page_for_posts_id ) :
				?>
				<span class="breadcrumbs-separator">
					<?php echo esc_html( $sep ); ?>
				</span>
				<span class="breadcrumbs-current">
					<?php echo esc_html( get_the_title( $page_for_posts_id ) ); ?>
				</span>
			<?php endif; ?>
		<?php elseif ( is_day() ) : ?>
			<span class="breadcrumbs-separator"><?php echo esc_html( $sep ); ?></span>
			<span class="breadcrumbs-current">
				<?php echo esc_html( get_the_date() ); ?>
			</span>
		<?php elseif ( is_month() ) : ?>
			<span class="breadcrumbs-separator"><?php echo esc_html( $sep ); ?></span>
			<span class="breadcrumbs-current">
				<?php echo esc_html( get_the_date( 'F Y' ) ); ?>
			</span>
		<?php elseif ( is_year() ) : ?>
			<span class="breadcrumbs-separator"><?php echo esc_html( $sep ); ?></span>
			<span class="breadcrumbs-current">
				<?php echo esc_html( get_the_date( 'Y' ) ); ?>
			</span>
		<?php elseif ( is_search() ) : ?>
			<span class="breadcrumbs-separator">
			<?php echo esc_html( $sep ); ?>
		</span>
			<span class="breadcrumbs-current">
			<?php
				printf(
					esc_html__( 'Search results for: %s', 'theme' ),
					esc_html( get_search_query() )
				);
			?>
		</span>
		<?php elseif ( is_archive() ) : ?>
			<span class="breadcrumbs-separator"><?php echo esc_html( $sep ); ?></span>
			<span class="breadcrumbs-current">
				Archives
			</span>
		<?php endif; ?>
	</nav>
</div>