WPMU Site-wide Breadcrumbs

Kudos to Dimox for a great non-plugin WordPress function for creating breadcrumbs.

For someone like me though, who is implementing a WordPress Mu site using “blogs” as content sections instead of the traditional community of blogs, I’d like to be able to have breadcrumbs that go more like this-

Home (root uri) » Blog Home (blog uri) » normal breadcrumbs

To accomplish this, I just made a few modifications to Dimox’s code and with the power of WordPress, Shazam!, it was done.

Here’s the chunk of code I added/modified (note, this code goes in your themes’ functions.php file):

// change the value of $home to your site's root URI (first level in the breadcrumbs)
$home = 'http://foo.com/';

// add two new variables for your blog info (second level in the breadcrumbs)

$blogURI = get_bloginfo('url');
$blogName = get_bloginfo('name');

// directly above the first line of code below in the original source, add the second row that references the new vars you've created  (for good measure I also nofollowed the home URI)

echo '<a href="' . $home . '" rel="nofollow">' . $name . '</a> ' . $delimiter . ' ';
/* if blog is home blog, don't display the blog name */
if ($blog_id != 1) {	echo '<a href="' . $blogURI . '">' . $blogName . '</a> ' . $delimiter . ' '; }

And that’s it, now just do everything else as Dimox suggests on his site.

Enjoy!

Comments (3)

  1. jean - Reply
    March 31, 2010

    Hi – thanks a million for doing this. I'm having trouble though placing the amendments in exactly the right place in the functions.php, so would it be possible for you to copy the entire code? Thanks so much!
    My recent post Free Guide to WordPress for Editors

  2. Grant - Reply
    July 16, 2010

    Hey,

    This is exactly what I have been looking for! Thanks for the code. Quick question though, would it be possible to change the default name from Home to another word?

    Thanks

  3. grant - Reply
    July 16, 2010

    I answered my own question when I looked at the original code! ha

Leave a Comment




    • Marty has been an active search marketing professional for over 12 years. He has consulted with the Fortune 100 and Fortune 500 as well as medium to small B2B and B2c businesses, governments and higher ed.