In this article I show you how to put breadcrumb in your WordPress website by using function the_breadcrumb(), will get the breadcrumbs for the current page this will need to go into the functions.php page.
[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();
}
}
}[/php]
Go to your single.php page and add the following code anywhere you want to display the breadcrumbs.
[php]<?php the_breadcrumb(); ?>[/php]
Comments