Code Snippets

WordPress Simple Breadcrumb Code

Function in function.php

	function the_breadcrumb() {
		if (!is_home()) {
			echo '<a href="';
			echo get_option('home');
			echo '">';
			bloginfo('name');
			echo "</a> » ";
			if (is_category() || is_single()) {
				the_category('title_li=');
				if (is_single()) {
					echo " » ";
					the_title();
				}
			} elseif (is_page()) {
				echo the_title();
			}
		}
	}

Code to call the funtion and display bread crumb.

<?php the_breadcrumb(); ?>

Reference: http://www.catswhocode.com/blog/how-to-breadcrumb-function-for-wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>