August 18th, 2009
WordPress Breadcrumbs
Breadcrumbs by Chris
Breadcrumbs code by Chrispoole.com. This is design to use in wordpress. Thanks chris.
/* * 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 ' &amp;raquo; <a href="'.$CPdir.'">' . str_replace("-", " ", $CPtext) . '</a>'; } } echo wp_title(); } CPbreadcrumbs();
Another example is adding in the function.php
Posted by Jean-Baptiste Jung in catswhocode.com. Simply adding this php code in your 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(); }}}
and call it in the page or in the header
Very simply and easy. Cheers to both you guys.