Skip to content

Instantly share code, notes, and snippets.

@rickrduncan
Last active October 22, 2020 08:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rickrduncan/7009158 to your computer and use it in GitHub Desktop.
Save rickrduncan/7009158 to your computer and use it in GitHub Desktop.
Customize Genesis breadcrumb
<?php
//* Do NOT include the opening php tag
//* Prefix author breadcrumb trail with the text 'Articles written by'
add_filter( 'genesis_breadcrumb_args', 'b3m_prefix_author_breadcrumb' );
function b3m_prefix_author_breadcrumb( $args ) {
$args['labels']['author'] = 'Articles written by ';
return $args;
}
<?php
//* Do NOT include the opening php tag
//* Change the breadcrumb separator
add_filter( 'genesis_breadcrumb_args', 'b3m_change_separator_breadcrumb' );
function b3m_change_separator_breadcrumb( $args ) {
$args['sep'] = ' &rsaquo; ';
return $args;
}
<?php
//* Do NOT include the opening php tag
//* Default arguments from the Genesis Breadcrumb
//* genesis/lib/classes/breadcrumb.php
$this->args = array(
'home' => __( 'Home', 'genesis' ),
'sep' => ' / ',
'list_sep' => ', ',
'prefix' => sprintf( '<div %s>', genesis_attr( 'breadcrumb' ) ),
'suffix' => '</div>',
'heirarchial_attachments' => true,
'heirarchial_categories' => true,
'labels' => array(
'prefix' => __( 'You are here: ', 'genesis' ),
'author' => __( 'Archives for ', 'genesis' ),
'category' => __( 'Archives for ', 'genesis' ),
'tag' => __( 'Archives for ', 'genesis' ),
'date' => __( 'Archives for ', 'genesis' ),
'search' => __( 'Search for ', 'genesis' ),
'tax' => __( 'Archives for ', 'genesis' ),
'post_type' => __( 'Archives for ', 'genesis' ),
'404' => __( 'Not found: ', 'genesis' )
)
);
<?php
//* Do NOT include the opening php tag
//* Change the word 'Home' that is at the front of breadcrumb trail
add_filter( 'genesis_breadcrumb_args', 'b3m_home_text_breadcrumb' );
function b3m_home_text_breadcrumb( $args ) {
$args['home'] = 'Home';
return $args;
}
<?php
//* Do NOT include the opening php tag
//* Reposition the Genesis breadcrumb to bottom of page
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_entry_footer', 'genesis_do_breadcrumbs' );
<?php
//* Do NOT include the opening php tag
//* Remove breadcrumb from a single page
add_action( 'genesis_before', 'b3m_remove_genesis_breadcrumb' );
function b3m_remove_genesis_breadcrumb() {
if ( is_page( 'resources' ) )
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
}
<?php
//* Do NOT include the opening php tag
//* Remove 'You are here' from the front of breadcrumb trail
add_filter( 'genesis_breadcrumb_args', 'b3m_prefix_breadcrumb' );
function b3m_prefix_breadcrumb( $args ) {
$args['labels']['prefix'] = '';
return $args;
}
@nda86
Copy link

nda86 commented Dec 14, 2014

How to add this breadcubs in category page???

@kfulk14
Copy link

kfulk14 commented Jun 23, 2017

I don't need the Home part of the breadcrumb so I left prefix blank 'prefix' => __( '', 'genesis' ),
Which removed the Home text does anybody know how to remove the first / that would come after the Home text
Right now my breadcrumb looks like /Page1 / Page2/ I would like to remove the / in front of Page1.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment