Blog
WPMU Site-wide Breadcrumbs
- February 23rd, 2010
- WordPress
- 3 Comments
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)
Leave a Comment