Adding Microformatted Breadcrumbs to Thesis

In custom_functions.php, I add the following function:

function breadcrumbs() {
	global $post;

	if (is_single()) {
		$aCategories = get_the_category($post->ID);
		<div itemscope itemtype="" id="breadcrumbs">
			You are here: <a href="" itemprop="url"><span itemprop="title">Eric Nagel</span></a> &gt;
			<span itemprop="child" itemscope itemtype="">
				<a href="/category/<?= $aCategories[0]->slug ?>" itemprop="url"><span itemprop="title"><?= $aCategories[0]->name ?></span></a> &gt;
				<span itemprop="child" itemscope itemtype="">
					<a href="<?php the_permalink(); ?>" itemprop="url"><span itemprop="title"><?php the_title() ?></span></a>

	} // ends if (is_single())
} // ends function breadcrumbs()

And then I add the hook to call the function:

add_action('thesis_hook_before_post', 'breadcrumbs');

Of course, you’ll want to take out the references to “Eric Nagel” and Also, my category slug is “category” but you may have changed yours. If so, make that change (line 10)

Read more about breadcrumbs, or test your code using Google’s Rich Snippets Testing Tool

How To & Tips
Share this Story:
  • facebook
  • twitter
  • gplus


  1. James Seligman
    1801 days ago

    Great Stuff! One question, Will this affect SEO after adding it to a site that’s already a few years old?

    • Eric Nagel
      1800 days ago

      It shouldn’t negatively affect it. I can only see it helping, not hurting.

  2. James Seligman
    1799 days ago

    Okay, I’ll give it a try.

Leave a comment