WordPress.org

Ready to get started?Download WordPress

Forums

Breadcrumbs Everywhere
Breadcrumbs Everywhere with Genesis and BP 1.8.1 (3 posts)

  1. lflier
    Member
    Posted 8 months ago #

    Thank you for this very helpful plugin. I'm configuring a WordPress site using the Genesis Minimum Pro theme with BuddyPress and bbPress. Genesis and bbPress have their own breadcrumb features which can be made to look identical using CSS. But BuddyPress does not come with this feature. I want a consistent look across the site and so it was important to implement breadcrumbs on the BuddyPress pages as well. This plugin works, but I had to make some modifications to the theme and to the plugin.

    My first challenge was installing the plugin under Genesis. Pasting the function call into my BuddyPress header.php did not work because Genesis handles the output. What I wound up doing was customizing the Genesis breadcrumb function and putting the Breadcrumbs Everywhere function call there. I won't claim that my code is terribly streamlined, but here is what I did:

    remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
    add_action( 'genesis_after_header', 'breadcrumbs_with_wrapper' );
    function breadcrumbs_with_wrapper() {
    
    	if ( !is_home() /* && (!is_archive() || !is_bbpress() )*/ ){
    
    		/* Create container */
    
    		printf( '<div %s>', genesis_attr( 'breadcrumb-container' ) );
    		genesis_structural_wrap( 'breadcrumb-container' );
    
    		/* Code from Genesis breadcrumb function to output breadcrumbs */
    
    		if (
    			( ( 'posts' === get_option( 'show_on_front' ) && is_home() ) && ! genesis_get_option( 'breadcrumb_home' ) ) ||
    			( ( 'page' === get_option( 'show_on_front' ) && is_front_page() ) && ! genesis_get_option( 'breadcrumb_front_page' ) ) ||
    			( ( 'page' === get_option( 'show_on_front' ) && is_home() ) && ! genesis_get_option( 'breadcrumb_posts_page' ) ) ||
    			( is_single() && ! genesis_get_option( 'breadcrumb_single' ) ) ||
    			( is_page() && ! genesis_get_option( 'breadcrumb_page' ) ) ||
    			( ( is_archive() || is_search() ) && ! genesis_get_option( 'breadcrumb_archive' ) ) ||
    			( is_404() && ! genesis_get_option( 'breadcrumb_404' ) ) ||
    			( is_attachment() && ! genesis_get_option( 'breadcrumb_attachment' ) )
    		)
    			return;
    
    		if ( function_exists( 'bcn_display' ) ) {
    			echo '<div class="breadcrumb" itemprop="breadcrumb">';
    			bcn_display();
    			echo '</div>';
    		}
    		elseif ( function_exists( 'yoast_breadcrumb' ) ) {
    			yoast_breadcrumb( '<div class="breadcrumb">', '</div>' );
    		}
    		elseif ( function_exists( 'breadcrumbs' ) ) {
    			breadcrumbs();
    		}
    		elseif ( function_exists( 'crumbs' ) ) {
    			crumbs();
    		}
    		elseif ( function_exists( 'breadcrumbs_everywhere' ) ) {
    			breadcrumbs_everywhere();
    		}
    		else {
    			genesis_breadcrumb();
    		}
    
    		/* Close the container */
    
    		genesis_structural_wrap( 'breadcrumb-container', 'close' );
    		echo '</div>';
    	}
    }

    This code works in my site, which consists of WP 3.6.1, BP 1.8.8, bbPress 2.4.1, with the bbPress Genesis Extend plugin by Jared Atchison. (I am not using the Genesis Connect Plugin for BuddyPress. BP versions 1.7 and beyond seem to work without it.)

    http://wordpress.org/plugins/breadcrumbs-everywhere/

  2. lflier
    Member
    Posted 8 months ago #

    My second challenge was modifying the plugin to get the breadcrumbs to display on my Member and Activity pages. When I installed the plugin on a clean install of BuddyPress using the stock BP theme, the breadcrumbs showed up everywhere they were supposed to. But in my theme, they did not appear on the Member and Activity pages; only on the user pages.

    Modifying the plugin with the code below did the trick:

    if ( bp_is_user() && !bp_is_register_page() ) {
    echo $startpages . " $divider " . '<a href="' . $homeurl . '/' . $page1 . '/">' . ucwords($page1) . '</a>' . " $divider " . '<a href="' . $bp->displayed_user->domain . '">' . ucwords($bp->displayed_user->fullname)  . '</a>' . " $divider " . ucwords($bp->current_component)  . "";
    } elseif (bp_is_current_component ( 'activity' ) || bp_is_current_component ( 'members' ) ){
    echo $startpages . " $divider " .  get_the_title()  . "";
    }
  3. betsyk
    Member
    Plugin Author

    Posted 7 months ago #

    Thanks for taking the time to share this information, lflier. It will be very helpful for Genesis themers.

Reply

You must log in to post.

About this Plugin

About this Topic