Skip to content

Instantly share code, notes, and snippets.

@darinronne
Last active September 20, 2017 19:01
Show Gist options
  • Save darinronne/0d8649593dc77795b40a4ff4995e21e3 to your computer and use it in GitHub Desktop.
Save darinronne/0d8649593dc77795b40a4ff4995e21e3 to your computer and use it in GitHub Desktop.
Yoast Breadcrumbs on The Events Calendar pages
<?php /*
As of this writing (Sep 2017) Yoast doesn't output the
breadcrumbs correctly on a Single Tribe Events page.
It only outputs "Home".
I couldn't find anything helpful or a solution
that works, so I am doing it this way.
I copy/pasted the breadcrumbs from another page that was two levels deep as a starting point.
If Yoast changes how they output breadcrumbs, then this will have to be updated.
You may need to update the separators below (&gt;) if they are different from your Yoast settings.
*/ ?>
<?php if ( function_exists( 'yoast_breadcrumb' ) ) : ?>
<?php if( is_singular( 'tribe_events' ) ) : ?>
<div class="breadcrumbs-bar__breadcrumbs"><span xmlns:v="http://rdf.data-vocabulary.org/#"><span typeof="v:Breadcrumb"><a href="<?php echo home_url(); ?>" rel="v:url" property="v:title">Home</a> &gt; <span rel="v:child" typeof="v:Breadcrumb"><a href="<?php echo home_url( 'events' ); ?>" rel="v:url" property="v:title">Events</a> &gt; <span class="breadcrumb_last"><?php single_post_title(); ?></span></span></span></span></div>
<?php else : ?>
<?php yoast_breadcrumb( '<div class="breadcrumbs-bar__breadcrumbs">', '</div>' ); ?>
<?php endif; ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment