This PhP script implements a breadcrumbs menu (see example below), which should work out of the box with Wordpress.
<?php
/*
* quick and dirty breadcrumb menu
* initially designed for wordpress
*/
function CPbreadcrumbs() {
$CPtheFullUrl = $_SERVER["REQUEST_URI"];
$CPurlArray=explode("/",$CPtheFullUrl);
echo '<a href="/">Home</a>';
while (list($CPj,$CPtext) = each($CPurlArray)) {
$CPdir='';
if ($CPj > 1) {
$CPi=1;
while ($CPi < $CPj) {
$CPdir .= '/' . $CPurlArray[$CPi];
$CPtext = $CPurlArray[$CPi];
$CPi++;
}
if($CPj < count($CPurlArray)-1) echo ' » <a href="'.$CPdir.'">' . str_replace("-", " ", $CPtext) . '</a>';
}
}
echo wp_title();
}
CPbreadcrumbs();
?>
To use it, just put that block of code into your Wordpress file where you want the menu to appear.
If you don’t use Wordpress but still want to use this, you may have to change
REQUEST_URI
at the start of the script to PHP_SELF
. And then at the bottom,
change wp_title()
to be a function that gives the title of the current page.