Revisited: Showing Events and Venues in Breadcrumbs

Published on: July 2, 2012 |Tags: ,,,,,, | Categories: Tutorial

The Events Calendar comes with a few built-in conditionals that can be very useful when customizing your templates.

The Question

Recently, a user asked why events were not showing up correctly in his breadcrumbs.

The Answer

Unless your breadcrumb code is checking for custom taxonomies, it’s not going to know what to do with events and venues. Most breadcrumb plugins use a mix of conditionals to determine what to show, and often custom taxonomies don’t make it into the mix. So, let’s fix that!

The Code

Here’s a code snippet you can drop in your functions.php file that uses the built-in conditionals to handle events and venues.

  • You can use it verbatim just add tribe_breadcrumbs(); to your page template.
  • Or if you use a theme framework, just add an action hook wherever you want the breadcrumbs to appear: add_action(‘hook_name’,’tribe_breadcrumbs’);
// Check if page is direct child
function is_child($page_id) {
    global $post;
    if( is_page() && ($post->post_parent != '') ) {
       return true;
    } else {
       return false;

function tribe_breadcrumbs() {

	global $post;

	$seperator = " » ";
	echo '<a href="';
	echo get_option('home');
	echo '">';
	echo "</a>";

    if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page

    	echo $seperator;
    	echo 'The Events Calendar';

    } elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages

	global $wp_query;
	$term_slug = $wp_query->query_vars['tribe_events_cat'];
	$term = get_term_by('slug', $term_slug, 'tribe_events_cat');
	get_term( $term_id, 'tribe_events_cat' );
	$name = $term->name;
	echo $seperator;
      echo '<a href="'.tribe_get_events_link().'">Events</a>';
      echo $seperator;
      echo $name;

		} elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List

			echo $seperator;
      echo 'Events List';

		} elseif( tribe_is_event() && is_single() ) { // Single Events

			echo $seperator;
			echo '<a href="'.tribe_get_events_link().'">Events</a>';
			echo $seperator;

		} elseif( tribe_is_day() ) { // Single Event Days

			global $wp_query;
			echo $seperator;
			echo '<a href="'.tribe_get_events_link().'">Events</a>';
			echo $seperator;
			echo 'Events on: ' . date('F j, Y', strtotime($wp_query->query_vars['eventDate']));

		} elseif( tribe_is_venue() ) { // Single Venues

			echo $seperator;
      echo '<a href="'.tribe_get_events_link().'">Events</a>';
      echo $seperator;

		} elseif (is_category() || is_single()) {

			echo $seperator;
			the_category(' &bull; ');
			if (is_single()) {
				echo ' '.$seperator.' ';

    } elseif (is_page()) {

    	if(is_child(get_the_ID())) {
    		echo $seperator;
    		echo '<a href="' . get_permalink($post->post_parent) . '">' . get_the_title($post->post_parent) . '</a>';
    		echo $seperator;
      	echo the_title();
    	} else {
    		echo $seperator;
      	echo the_title();

		} elseif (is_search()) {

      echo $seperator.'Search Results for... ';
			echo '"<em>';
			echo the_search_query();
			echo '</em>"';



This code is based on the Thesis Breadcrumbs Without Plugins code.

10 Responses to Revisited: Showing Events and Venues in Breadcrumbs

  1. Tilo says

    I am using the Yoast Breadcrumbs ( How can I integrate the code to this plugin?

  2. Nick Ciske says


    The answer is right on the page you linked to in the “Advanced use of WordPress Breadcrumbs” section.

    You can use that piece of code to overwrite the Yoast generated breadcrumbs with some code extracted from the sample code above.

    • Simon James says

      I’m also using Yoast Breadcrumbs and I’m not sure exactly which bits of codes to use from the above…? Hoping you can help.

  3. Mike says

    Unfortunately this really doesn’t work very well. I had to modify a lot of the code for the Woo Framework, and this breadcrumb code only displays the home level, and the current level – none of the parent levels.

    The Yoast breadcrumb is good, but it doesn’t display the custom taxonomies.

    Unfortunately Nick’s reply isn’t very helpful either. Yoast’s description allows you to set a prefix or suffix, or return the whole breadcrumb in a variable rather than print it. It certainly doesn’t help to incorporate custom taxonomies.

  4. Nick Ciske says


    We can’t write breadcrumb code for every framework or situation, or we would just include it in a plugin or add-on. The code above is simply an example of how to go about it — the rest is an exercise left to the reader.

    RE: Yoast – “or return the whole breadcrumb in a variable rather than print it” — which you could then overwrite with a custom taxonomy aware breadcrumb as needed before output (e.g. if the page requires it). Not the most elegant solution, but it would work.

  5. Tony says

    This breadcrumb code doesn’t work. It puts the breadcrumb code in quotes so that it simply appears on the front end as a string of text/

  6. Tony says

    Realised why the above code doesn’t work now: it’s because it is using character entities so if you copy and paste it, it just renders as text.

    Also, the code doesn’t work anyway, even if you change all the character entities. On the listview page it shows home >> events >> first even on the list.

    • Jonah says

      Hi Tony,

      I just revised the code above. Want to try out the new code and let us know how it goes?


  7. Kathryn says

    I have tried out the code above for the breadcrumbs, but it’s not ready for ptime time!
    If you are on a sub-sub page (not event-regular pages) you get the home and the current page in the breadcrumb – but you don’t get the page(s) in the middle still

    Any clues?

    • Jonah West says

      Hi Kathryn,

      This beadcrumbs class was never meant to be a full breadcrumb solution and we can’t guarantee that it’s going to handle 100% every permutation out there. My suggestion for a more full solution would be something like:

      That being said, I wrangled the code a bit more, adding a function to be able to check for parent pages, and conditionally checking if a page has a parent page and if it does, include that in the breadcrumb trail. I hope that helps!

      – Jonah