Jump to Sidebar Content | Jump to Main Page Content

Begin site navigation:
End site navigation.
Begin left menu:
Topics

Pages

 
Search
 
Links
 
Subscribe
 
End of left menu.
Begin main content:
Blog

Bread Your BuddyPress With Breadcrumbs Everywhere

Saturday, February 25, 2012 10:48 pm

A couple of weeks ago, I was trying to customize some BuddyPress navigation and thought it would be pretty easy, maybe an hour or two. As I dug into it further, a few hours turned into a few days and I started writing a fairly detailed function. With so much time invested, I figured I’d share the code here when I was done. But midway through I realized it would work as a plugin as well.

So I wrote my first WordPress plugin, Breadcrumbs Everywhere.


Photo by Boegh

Description

Missing crumbs? Find them with Breadcrumbs Everywhere! This plugin adds breadcrumb trail navigation to BuddyPress. Simple, just add one line of code to your template. You don’t need to use it, but there is an admin feature, too. Requires BuddyPress 1.5 or higher.

Download the Plugin

** Download the stable release from WordPress.org **

Current Version

1.6 release 2013-12-19
breadcrumbs-everywhere.1.6.zip

Current Beta

None

Previous Releases

1.5 release 2013-12-18
breadcrumbs-everywhere.1.5.zip

1.4 release 2013-02-21
breadcrumbs-everywhere.1.4.zip

1.3 release 2012-08-07
breadcrumbs-everywhere.1.3.zip

1.2 release 2012-05-04
breadcrumbs-everywhere.1.2.zip

1.1 release 2012-04-17
breadcrumbs-everywhere.1.1.zip

1.0 initial release 2012-02-25
breadcrumbs-everywhere.1.0.zip

Demo

You can see a customized version of the plugin in use on the Art Directors Club of Denver website. Check out a member profile.

Installation

• Upload the breadcrumbs-everywhere folder to the /wp-content/plugins/ directory
• Activate the plugin through the ‘Plugins’ menu in WordPress
• Add this function anywhere in your BuddyPress template, typically in header.php:

<?php if (function_exists('breadcrumbs_everywhere')) breadcrumbs_everywhere(); ?>

• That’s it!

Screenshots


Breadcrumbs on Member pages

Breadcrumbs on Group pages

Admin page

How to change the default settings

Breadcrumbs Everywhere works as a one step template tag using the BuddyPress default page names: Members, Groups, Activity, and Forums. If you have renamed these pages the plugin will use your custom names instead. Additionally, an admin feature is available to change these default settings (possibly with more options in the future):

• Text for the Home link
• Text for the Blog link
• Text for the breadcrumb divider

From the WordPress admin menu, go `BuddyPress > Breadcrumbs Everywhere`.

How to display breadcrumbs for BuddyPress Actions

Trails to Level 5 Actions (i.e. Home > Members > Admin > Messages > Sent) are possible, but they are not activated by default. See /includes/crumbs-core.php for customization instructions.

How to display breadcrumbs on my primary Home or Blog pages

Including a Home link on your Home page (or a Blog link on your main Blog page) is possible, but this is not activated by default. See /includes/crumbs-core.php for customization instructions.

Changelog

= 1.6 =
* Maintenance release, improved performance
* Fixed “Trying to get property of non-object” notice on line 39 in Debug Mode
* Fixed “Undefined variable: id” notice on lines 119, 286, 288, 292, 322 in Debug Mode
* Fixed “Undefined variable: groupactions” notice on line 194 in Debug Mode
* Fixed “Undefined property: WP_Error::$term_id” notice on line 323 in Debug Mode
* Fixed “Undefined property: WP_Error::$parent” notice on line 324 in Debug Mode
* Fixed “Undefined variable: prefix” notice on line 326 in Debug Mode
* Fixed “Undefined variable: display” notice on line 326 in Debug Mode
* Added title attribute to links
* Added Italian PO file in `/languages`

= 1.5 =
* Prep work for localization (suggested by angslycke – thanks!)
* Added German, French and Spanish PO files in /languages
* Added schema.org microdata (suggested by miguelcortereal - thanks!)
* Current items on pages are now linked by default (for microdata structure)
* Changed relative links to absolute URLs in Groups chain (for microdata structure)
* Improved formatting for Groups default tab (i.e. Child Group > home = Child Group > Home)
* Improved compliance with WordPress PHP doc/code standards
* Moderate code rewrite
* Tested for BP 1.9

= 1.4 =
* Crumbs now display in title case on Member pages
* Tested for BP 1.7-beta1

= 1.3 =
* Changed bp_has_profile() to bp_is_user() in crumbs-core.php
* Minor HTML formatting in crumbs-admin.php

= 1.2 =
* Crumbs now detect posts on home vs. static home page
* Removed Blog link if posts are on front
* Removed Members link from registration pages
* Added top-level crumbs on plugin pages
* Minor code cleanup

= 1.1 =
* Changed bp_init to bp_include in loader.php
* Updated plugin homepage URL in loader.php
* Improved formatting for paginated pages
* Crumbs now display on attachment posts and pages
* Level 5 actions on Groups now show by default
* Improved formatting for slug-based crumbs (i.e. Group > Send-invites = Group > Send Invites)
* Added compatibility for BP Group Hierarchy
* Added compatibility for Achievements for BuddyPress
* Added compatibility for multisite installations

= 1.0 =
* Initial release

Reviews

Daily Tip: Add Breadcrumbs Everywhere within BuddyPress – Sarah Gooding | wpmu.org

More Info

Huge thanks to the BuddyPress development team for the BuddyPress Skeleton Component plugin which served as a template for structuring the core files and writing my admin component.

I hope the plugin is useful to you — enjoy!

Comments

  1. Looks like an awesome plugin – and very impressive for a first plugin. I’ll test it out on localhost this week with the aim of pushing to production server by next week. Please let me know when your plugin is in the WordPress.org repository.

  2. Thank you, Vernon!! I’d love to know how the plugin works for you and if there are features you’d like to see. Will report back when I have mastered Subversion haha…

  3. If you use Windows then @pgibbs helped point out Subversion how-to articles in https://twitter.com/#!/pgibbs/status/165950086566789120

    I’ll get back to you once I’ve done the testing.

    Thanks again.

    Cheers,
    Vernon

  4. Hello,

    Thank you for the plugin! Is this the place you’d like bug reports? Here are a couple of issues:

    1. In the Dashboard, when I try to save my settings, I get “You do not have sufficient permissions to access this page.” The breadcrumbs do work, up to a point…

    2. There seems to be a conflict with the Buddyvents plugin (no errors show up). The developer has a test site: http://test.shabushabu.eu/events/ This will take you to the “Events” tab. In it will be a list of events. If you click on an event, the detail for that event is shown. On my site, with your plugin activated, any markup/php below the inserted function in my header.php file does not process. It’s as though the function tells php to stop processing the page from that point on, but only when trying to get to the detail for that event.

    That’s all I have so far.

    Thanks!

    Quint

  5. Yay, Breadcrumbs Everywhere is now in the plugin repository. And TortoiseSVN is great! Was leaning toward Subversion’s CLI but didn’t want to crash my xampp setup.

  6. Thanks, Quint! Sounds like BE may be loading before BuddyPress initializes. I included a check to detect this, but maybe it needs adjusting? I don’t have access to Buddyvents, would you be willing to test the 1.1 beta zip file above? If that resolves the problem, I’ll release an update. Thank you!

  7. Hello Betsy,

    Still the same issue. If you provide me with an email address, I will send you admin credentials to my non-production site where you could troubleshoot?

  8. Hello -

    I’m using the Buddypress Groups Hierarchy plugin and I’m trying to get a breadcrumb plugin that will recognize the parent child relationship between groups.

    For example, when I am in a child group I would like the breadcrumb to be:

    Home » groups » Parent Group » Child Group » home

    But it actually displays as:

    Home » groups » Child Group » home

    Interestingly, when I hover over the breadcrumb for the child group, the URL it points to does display correctly – meaning it shows http://www.examplesite.com/groups/parent-group/child-group/

    Can you provide some guidance on what I would need to change so that both parent and child groups display in the URL?

    It’s a great plugin!!!

  9. Hey Larry, sorry for being slow to respond. So glad you like the plugin! That was a tricky request, but I have reworked the Groups portion to check for group parents. If you need this functionality right now, I posted a beta zip file above that you can try (1.1.a)(hmm…that should probably be a number). Or wait for the formal 1.1 release which includes this and a few other fixes — should have that out for everyone this week. Thanks!

  10. Betsy this is exactly the type of thing I’m looking for I’m using latest WordPress + BuddyPress + Genesis Framework + News Theme and for the life of me I can’t find a header.php area that works.

    When you suggest putting the line of code in the buddypress template, that’s where things go wrong. The only header.php is part of Genesis Framework (and located in wp-content/themes/genesis) and it says not to modify the core file use a theme file, but my News theme has no specific header.php. Although there is a header.php in the Buddypress default theme (wp-content/plugins/buddypress/bp-themes/bp-default) it doesn’t seem to do anything if placed there.

    Any thoughts on using it within this framework?

  11. Hi Doug, your theme is probably using default Genesis Framework core files and you definitely don’t want to be editing those. I recommend using the Genesis Simple Hooks plugin as it allows you to modify your Genesis theme via their hook system. My guess would be to insert the Breadcrumbs Everywhere function at ‘genesis_after_header’ or ‘genesis_before_content’, but check their hook reference guide. In the Simple Hooks plugin, add the Breadcrumbs Everywhere function code and check the box that says “execute PHP on this hook”. Let me know if that helps…

  12. Hello Betsy,

    So far, so good. Your latest update seems to have addressed the issue I brought to your attention back in February.

    Thank you very much for your hard work!!!

    Quint

  13. Hooray! Glad to hear that, Quint! Had some learning to do. ;) Best of luck with the website!!

  14. Actually it doesn’t work under any location in Simple Hooks. According to the authors, Genesis/Wordpress basically don’t see Buddypress at all – to those loops everything is a 404 error. This suggests to me that the spots addressed in Simple Hooks will not be called when Buddypress pages are being called, and indeed this seems like the case.

    Any other thoughts?

  15. Doug, are you also using the Genesis Connect plugin to make your News theme compatible with BuddyPress? My understanding is that Genesis doesn’t support base BuddyPress installs without it.

    I peeked at their tutorials. You can create an editable header.php file by copying the one from the Genesis parent theme and placing it in your News theme folder. Your copy will be used instead — try adding the breadcrumbs_everywhere function there.

    Also, Genesis has their own breadcrumbs hook. That may be the best option? Let me know how it goes. :)

  16. Hi, you plugin is awesome, I just wish I could get rid of the “Blog” Slug, is there any easy way to do this?

    Regards-

  17. Great catch, @kozmica! A fix for this will be included in v.1.2, coming this week. Thanks!

  18. Hi Betsy,

    This plugin is awesome!
    But I still no luck installing on WP 3.4.1 with BP 1.5.5. No breadcrumbs showing up.
    Is there compatibility issue with those versions?

    Thanks,
    [bayu]

  19. Glad you like it, Bayu. I tested on WP 3.4.1/BP 1.5.5 and WP 3.4.1/BP 1.5.6 and everything appears to be working fine. Haven’t had any other reports of problems. Can you provide more details? Are you seeing an error message?

  20. Hie! Betsy I like your plugin but it breaks the posts getting this error : Catchable fatal error: Object of class WP_Error could not be converted to string in /home/facenair/public_html/wp-content/plugins/breadcrumbs-everywhere/includes/crumbs-core.php on line 230

    Everything else fine. Sorry I am using WP 3.3.2/BP 1.5.6 my theme is Buddyboss 2.0.3

  21. Peter, that sounds like a theme-specific problem. Have you tried switching to the default theme? You may need to modify the plugin for your environment, for example, if your theme is using custom post types or taxonomies.

  22. Hello Betsy,

    I’ve upgraded Buddypress to version 1.6. It seems that your plugin needs an update? Whereas 1.5.7 displayed the breadcrumbs properly, it now shows incorrectly stated crumbs. Should you want to see what I mean, the credentials provided to you in the past should still work. Thanks!

    Quint

  23. Thanks for the heads up, Quint! I’ll look into it asap. Sorry for the trouble!

  24. Think I got it – v.1.3 is now out. Quint, everyone, please give it a run and let me know if any other problems arise. Thanks!

  25. Thanks for the quick turnaround, Betsy! I’ve activated it and it works.

    Just a couple of observations:

    1. For the Members Directory, by default the All Members tab is selected; however, that tab’s name isn’t a crumb. In addition, if other Buddypress plugins are installed such as. Following/Followers, where if I select that tab, that crumb doesn’t show.

    2. Item 1 above also happens for the Activity feed.

    3. I assume the following can be controlled with CSS: the crumbs for the tabs (in the member’s profile for example) are not capitalized. Is there a class that I can use to apply capitalization?

    Thanks for supporting this plugin!

    Quint

  26. Ok, here’s my best attempt at an answer for that: if the page is a root component, there isn’t a current component for me to pull as a crumb. So for the Members Directory, $bp->root_component = $bp->current_component = /members = we’re at Level 0.

    Many BP plugins install as root components. Achievements is a good example. Even though there is a default “All Achievements” tab, no default component is actually being viewed: example.org/achievements. The chain doesn’t begin until a component is clicked: example.org/achievements/rock-star.

    Per the $bp global, “if no component is being viewed (for example on the root) then current_component will equal $bp->default_component.” It can be defined in bp-custom.php, but the BuddyPress default is “activity”. When included, it appends a crumb at the end of all root components: Home > Achievements > Activity in the absence of a slug (the URL is still example.org/achievements). While I did include it down the breadcrumb trail (Home > Members > Username > Activity), it seemed less intuitive to me on root components so I dropped it off.

    So, to make a VERY long story short, there does not appear to be a way to represent the root component default tab name. However, I can fake it by inserting “All” + current_component. That would catch most, but not all such as the Activity page which also (why?) reads “All Members”. And it could really break down on plugin pages.

    Thoughts?

    It’s very easy to format using CSS. I recommend wrapping the function in a div and adding a class in your stylesheet:


    div class="crumbs"
    ?php if (function_exists('breadcrumbs_everywhere')) breadcrumbs_everywhere(); ?
    /div

    .crumbs {
    text-transform: capitalize; /* options: capitalize | uppercase | lowercase | none | inherit */
    }

    Or add the styles inline as this:

    div style="text-transform: capitalize;"

    Thanks again for the feedback – let me know if you have more ideas!

  27. Hello Betsy,

    Thank you for laying out your “long-short story”! ;-) Uhm, I think that given your explanation, the way it works presently is just fine.

    And thank you for the div & styling recommendation! It just works.

    Quint

  28. Thank you Betsy,
    It is work well on my site. Just simple to custom breadcrumbs.
    Works on wp 3.4.1 and bp 1.6.1

  29. Thank you, Andhik. :)

  30. Hi Betsy,

    This does not work in WordPress 3.5.1, I installed / activated, and the function is not found. I also uninstalled / reinstalled, same result.

  31. Hi Payson, did you add the Breadcrumbs Everywhere function to your BuddyPress template? Typically, to your header.php file. Here are the installation instructions. Let me know, Betsy.

  32. Hi!

    I’m was trying to install the breadcrumbs as in your instructions and your instructions are slightly incorrect:

    You have:

    What is needed:

    If you look carefully the single quotes are different. PHP requires ASCII single quotes, but in your example you have some “fancy” quotes that look really good, but are syntactically incorrect.

    Payson: This may be your trouble as well.

    Thanks for awesome plugin!

  33. Ha!

    So, that code line was scrubbed from the comments, makes sense. I’ll do it again without the php tags. :)

    You have:

    if (function_exists(‘breadcrumbs_everywhere’)) breadcrumbs_everywhere();

    What is needed:

    if (function_exists('breadcrumbs_everywhere')) breadcrumbs_everywhere();

  34. LOL. This is wordpress being evil. I give up, I hope you understand what I’m trying to point out. :)

  35. Thanks, Mayhem – curly quotes were cool in 2006. ;) I formatted that line of code (and the one in your comment) to prevent any confusion. I greatly appreciate the time you took to clarify this for others.

Add Your Comment



End of main content.