Add Breadcumbs without a plugin!
You can show users and guest to where they are in your blog. You can do this with breadcumbs easily. There are some plugins for that but if you want to add breadcumbs your theme or if you a theme developer you can use this function. This code is very simple, pretty and good.
Firstly you have to create a php file with named “breadcumbs.php“. After that paste this code below into the file:
<div class="breadcrumbs">
<?php
function breadcrumbs() {
$theFullUrl = $_SERVER["REQUEST_URI"];
$urlArray=explode("/",$theFullUrl);
echo 'You Are Here: <a href="/">Home</a>';
while (list($j,$text) = each($urlArray)) {
$dir=";
if ($j > 1) {
$i=1;
while ($i < $j) {
$dir .= '/' . $urlArray[$i];
$text = $urlArray[$i];
$i ;
}
if($j < count($urlArray)-1) echo ' » <a href="'.$dir.'">' . str_replace("-", " ", $text) . '</a>';
}
}
echo wp_title();
}
breadcrumbs();
?>
</div><!-/breadcrumbs->
Send this breadcumbs.php into your themes root path. After that you can use this code where you want in your theme:
<?php include ( TEMPLATEPATH . '/breadcrumbs.php'); ?>
You can use a class style named breadcumbs with this file and code. You can edit with your base styleshet.
That’s All! Have a nice day.

Recent Comments