Hello,
Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.
The PHP code you mentioned is not supposed to be added using the Code Snippets plugin as that will add the code as if it were inside the functions.php file and the breadcrumbs need to be in your template pages.
Usually, these pages are called single.php or page.php on your theme but this might differ from theme to theme.
Please add the complete PHP code from the Breadcrumbs settings to your template pages and see if that helps show the breadcrumbs.
Don’t hesitate to get in touch if you have any other questions.
Thanks, i will try that. I deduced from your answer that the settings in the Rankmath > General > breadcrumbs are just that. Settings. And when the breadcrumb is called it will use the settings there.
Meaning that: Enabling breadcrumbs will only show if the php is present.
Since im not using a child theme, and want to be able to update the theme when an update is ready im not comfortable editing the single or page.php.
So i added a filter that will generate the breadcrumbs anywhere, before the content.
add_filter( 'the_content', 'filter_the_content_in_the_main_loop', 1 );
function filter_the_content_in_the_main_loop( $content ) {
if( function_exists( 'rank_math_get_breadcrumbs' ) ) {
$content = rank_math_get_breadcrumbs() . $content;
}
return $content;
}
I don’t see a downside by doing it this way, unless you know of one you could share with me.
Hello,
There’s no downside of doing it this way if you want to be able to update the theme freely without worrying about the breadcrumbs.
In fact, some of our clients prefer to use the breadcrumbs this way for the very same reasons as you.
Don’t hesitate to get in touch if you have any other questions.
Thanks for you help. This is solved 🙂
Hello,
Glad that helped.
Please feel free to reach out to us again in case you need any other assistance.
We are here to help.
Thank you.