Skip to content

Instantly share code, notes, and snippets.

@KryptikOne
Created December 20, 2013 19:05
Show Gist options
  • Save KryptikOne/8059754 to your computer and use it in GitHub Desktop.
Save KryptikOne/8059754 to your computer and use it in GitHub Desktop.
Wordpress breadcrumbs without a plugin. REFERENCE: http://www.catswhocode.com/blog/how-to-breadcrumb-function-for-wordpress
// This goes in the functions.php file in your theme
<?php
function the_breadcrumb() {
if (!is_home()) {
echo '<a href="';
echo get_option('home');
echo '">';
echo "Home";
echo " / </a>";
if (is_category() || is_single()) {
the_category('title_li=');
if (is_single()) {
echo " / ";
the_title();
}
} elseif (is_page()) {
echo '<a href="';
echo the_permalink();
echo '">';
echo the_title();
echo "</a>";
}
}
}
?>
// Add this in your page templates where you want the breadcrumb to show up
<?php the_breadcrumb(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment