This template enables you to remove the default position of the breadcrumbs and add them back in any Genesis hook position.
In this case, we use the genesis_after_entry_content hook however you can use any genesis hook.
#Installation
Create a new file named single.php in your child themes root directory and add the following PHP code to the file.
#Conditionally Reposition Breadcrumbs
You could also use PHP code in your child themes functions.php file to conditionally remove and add back your breadcrumbs in any hook position like this :
add_action( 'genesis_before_loop', 'reposition_breadcrumbs_conditionally', 5 );
function reposition_breadcrumbs_conditionally() {
if ( is_singular( 'post' ) ) {
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_after_entry_content', 'genesis_do_breadcrumbs' );
}
}
Change the genesis_after_entry_content hook to any other genesis hook.
#Reposition Breadcrumbs After Header
add_action( 'genesis_meta', 'reposition_breadcrumbs_conditionally', 5 );
function reposition_breadcrumbs_conditionally() {
if ( is_singular( 'post' ) ) {
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_after_header', 'genesis_do_breadcrumbs' );
}
}
If you’re using the Genesis Sample child theme, you’ll also need to add CSS to display the breadcrumbs below the fixed header.
.breadcrumb {
margin-top: 40px;
}
Was This Tutorial Helpful?