4

How can I remove the current page from the breadcrumbs trail on a Genesis WordPress site? I've examined breadcrumb.php top to bottom, but am not sure which filter(s) I should hook into.

Thanks!

iSaumya
  • 1,503
  • 5
  • 21
  • 50
Jenni
  • 41
  • 4
  • I'm having the same question. It's really bad to see that no one has posted any answer for this. – iSaumya Mar 06 '15 at 16:05

3 Answers3

3

Bill Erickson has a snippet to remove the post title. This may be worth a shot to remove the current page title as well:

function be_remove_title_from_single_crumb( $crumb, $args ) {
    return substr( $crumb, 0, strrpos( $crumb, $args['sep'] ) );
}
add_filter( 'genesis_single_crumb', 'be_remove_title_from_single_crumb', 10, 2 );

http://www.billerickson.net/code/remove-post-title-from-breadcrumb/

I'm suprised there isn't more information out there about this.

Matt Whiteley
  • 476
  • 2
  • 9
0

But if you use Genesis Connect for WooCommerce plugin (to use WooCommerce with your Genesis site) and you need to remove the current page from the breadcrumbs from your products pages you need to do this:

function remove_title_from_single_product_crumb( $crumb, $args ) {
    return substr( $crumb, 0, strrpos( $crumb, $args['sep'] ) );
}
add_filter( 'gencwooc_single_product_crumb', 'remove_title_from_single_product_crumb', 10, 2 );
Leo Lukin
  • 1,201
  • 1
  • 11
  • 24
0

To remove specifically from pages, use 'genesis_page_crumb' filter with the same logic:

function be_remove_title_from_single_crumb( $crumb, $args ) {
    return substr( $crumb, 0, strrpos( $crumb, $args['sep'] ) );
}
add_filter( 'genesis_page_crumb', 'be_remove_title_from_single_crumb', 10, 2 );

You can also experiment with 'genesis_build_crumbs' filter that accepts $crumbs array and default breadcrumbs arguments array $args. It's used in Genesis Breadcrumbs class build_crumbs() method (more info here).

Oksana Romaniv
  • 1,569
  • 16
  • 18