Archived topic
Would Like to Move Breadcrumbs
3 replies · Started by Sandee on October 12, 2021
Hi --
I'm using the code found here: https://generatepress.com/forums/topic/how-to-add-breadcrumb-to-every-page-with-php-code/ to add breadcrumbs to my site, but they aren't in the position I'd like. I'd like them to be ABOVE the page header, but BELOW the site header/navigation. Can you help me move them?
Here's the code I'm using:
add_action( 'generate_after_header', function() {
if ( ! is_front_page() && function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb( '<div class="grid-container grid-parent"><p id="breadcrumbs">','</p></div>' );
}
} );
Thank you in advance for your help!
Hi Sandee,
Try this modification of the code you're using:
add_action( 'generate_after_header', function() {
if ( ! is_front_page() && function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb( '<div class="grid-container grid-parent"><p id="breadcrumbs">','</p></div>' );
}
}, 1 );
Let us know if it works for you.
Note: Here's a visual guide of the hooks you can use on the site incase you want to move it again - https://docs.generatepress.com/article/hooks-visual-guide/
Yes, that's perfect. I tried other hooks, but it was the priority I needed. I just wasn't sure where to add it.
Thanks so much!
Nice one. No problem. :D