Archived topic
Breadcrumbs not working on pages
6 replies · Started by Leon on October 27, 2019
Hello,
GP Premium with Elements enabled.
I've been reading:
Adding Breadcrumbs - Documentation
https://docs.generatepress.com/article/adding-breadcrumbs/
...and:
Implement Yoast SEO breadcrumbs - Yoast Knowledge Base
https://kb.yoast.com/kb/implement-wordpress-seo-breadcrumbs/
...yet the breadcrumbs don't display on pages. They do on blog posts.
I have entered the shortcode correctly: "Add the shortcode provided by Yoast in this article:"
I have [ wpseo_breadcrumb ] on line 1 and that is it. (Note: in shortcode, there are NO spaces between brackets and letters - I had to do that here to get the shortcode to display.)
I added a location rule and set it to Pages/All Pages
All other settings are as described in the GP article. I have Yoast Breadcrumbs enabled in the Yoast plugin settings too.
I have used Yoast in the past but never had to do this before because previous themes had a simple breadcrumb setting which was easy for the technically challenged like me.
I cleared my cache, checked in Brave incognito.
Thanks for your help.
Hi there,
Which hook are you currently using?
I checked the single post Website Dedevelopment and don't see breadcrumbs there either?
Hello Leo,
Thanks for your response.
I am using the before_entry_title hook as suggested in the GP article.
Apologies that the blog breadcrumbs weren't visible - I had been experimenting with possible solutions and at one stage had to restore my site.
Among other things, I tried making a separate hook for pages.
I have finished my research and have a resolution, - though it is not what I originally planned - some observations, and a question.
After disabling the original hook, I created another one except that this time I inserted:
<?php
if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb('
<p id="breadcrumbs">','</p>
');
}
?>
and then selected 'before_main_content", ticked "Execute PHP", selected Posts/All Posts and Pages/All Pages and excluded the front page.
The breadcrumbs now appear on both posts AND pages, and as it happens, in a better location (in my view).
I might add that when I tested "before_entry_title" the breadcrumbs appeared on posts, but NOT on pages - the same issue as before.
Do you have any idea why this is please? Is it a bug in GP perhaps?
Thank you.
Hi there,
the before_entry_title hook doesn't exist on Pages. You can see all the main hooks here:
Thanks for letting me know David. That explains it.
You're welcome