Skip to content

Commit

Permalink
Add breadcrumbs to the single Event page
Browse files Browse the repository at this point in the history
  • Loading branch information
bernattorras committed Jun 7, 2024
1 parent 6e56310 commit 0852863
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 5 additions & 2 deletions themes/osi/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
<main class="content--body <?php echo esc_attr( osi_main_class() ); ?>" role="main">

<section class="content--page" id="content-page">
<?php get_template_part( 'template-parts/breadcrumbs' ); ?>

<?php
if ( 'event' === get_post_type() ) {
get_template_part( 'template-parts/breadcrumbs-sc_event' );
} else {
get_template_part( 'template-parts/breadcrumbs' );
}
while ( have_posts() ) :
the_post();

Expand Down
13 changes: 10 additions & 3 deletions themes/osi/template-parts/breadcrumbs-sc_event.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
<nav class="entry-breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList">
<span itemprop="itemListElement" itemscope="" itemtype="https://schema.org/ListItem">
<meta itemprop="position" content="1">
<meta itemprop="position" content="0">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="home-link" itemprop="item" rel="home">
<span itemprop="name"><?php echo esc_html__( 'Home', 'osi' ); ?></span>
</a>
</span>
<span itemprop="itemListElement" itemscope="" itemtype="https://schema.org/ListItem">
<meta itemprop="position" content="2">
<a href="<?php echo esc_url( home_url( '/events/' ) ); ?>" class="events-link" itemprop="item">
<span itemprop="name"><?php echo esc_html__( 'Events', 'osi' ); ?></span>
</a>
</span>
<?php if ( is_single() && get_post_type() == 'event' ) : ?>
<span class="current-page" itemprop="itemListElement" itemscope="" itemtype="https://schema.org/ListItem">
<meta itemprop="position" content="1">
<span itemprop="name"><?php echo esc_html__( 'Events', 'osi' ); ?></span>
<meta itemprop="position" content="3">
<span itemprop="name"><?php echo esc_html( get_the_title() ); ?></span>
</span>
<?php endif; ?>
</nav>
</div><!-- .wrapper -->
</div><!-- .breadcrumb-area -->

0 comments on commit 0852863

Please sign in to comment.