Breadcrumbs Everywhere with Genesis and BP 1.8.1
-
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.)
- The topic ‘Breadcrumbs Everywhere with Genesis and BP 1.8.1’ is closed to new replies.