Archived topic
Volume: Implementing Breadcrumb & Position
9 replies · Started by Tim on March 21, 2020
Hello
Following this guide:
https://docs.generatepress.com/article/adding-breadcrumbs/
Suggests installing and configuring Yoast SEO for breadcrumbs:
https://yoast.com/help/implement-wordpress-seo-breadcrumbs/
and Utilising GP Hooks to place the breadcrumb using a shortcode.
Perhaps the guide needs updating since it was difficult to follow this procedure. Primarily a shortcode from Yoast could not be found.
Instead, it was far easier to add the code snippet offered
add_action( 'generate_after_header', function() {
if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb( '<div class="grid-container grid-parent"><p id="breadcrumbs">','</p></div>' );
}
} );
that places the breadcrumb at generate_after_header
1. Which hook location would place the breadcrumb inside the hero just under the header and before the Page/Post Title ?
2. I prefer to float the breadcrumb right and read RTL. Is there a way to run the breadcrumb labels RTL eg: crumb 3 < crumb 2 < crumb 1 ?
Hi there,
yeah i think we need to revisit the Yoast documentation seeing as they have made it even more difficult to find the shortcode which used to be this wpseo_breadcrumb - of course it will wrapped in [squarebrackets] which i can't add here as the site uses Yoast for now.
1. Header Elements don't have Hooks inside them and neither will they accept PHP - but they do accept shortcodes You would need to add the above Shortcode inside the header element.
2. You would need to ask Yoast as GP doesn't control the breadcrumb output.
Hi David
Yes wpseo_breadcrumbwith surrounding [] does work in a Hook. But I'm failing to see which hook location will place the breadcrumb inside the Hero immediately after the Header.
What would be the best practice for doing that ?
Thanks
Tim
You would need to add the shortcode inside the Header Element itself.
Hi David
Thanks I did get that working, but I'm still hunting for a method to display the crumbs RTL.
Glad to hear that - have a chat with RankMath support :)
Hi, sorry for my meddling. I would like the breadcrumbs of my theme to load in the hero title. I add the code inside the header element itself and it doesn't work. Could you help me detect what I am doing wrong?
<?php
if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb( '<p id="breadcrumbs">','</p>' );
}
?>
<h1>
{{post_title}}
</h1>
Hi there,
Header Elements do not support PHP but they do support shortcodes, Yoast has its own shortcode you can use which is provided here:
https://yoast.com/help/implement-wordpress-seo-breadcrumbs/#pageshortcode
Hello david
Thanks to your help I made it work.
A greeting from Spain
Glad to be of help!