Archived topic
Trying to add breadcrumbs to post pages
3 replies · Started by Kevin on October 16, 2018
Hello, this is my first day using this theme. I am trying to use a hook to display breadcrumbs from Yoast SEO after_header. I added a new element (a hook). Under display rules I have location set to all posts.
I am currently using this code that I found on a previous thread.
<?php if ( function_exists('yoast_breadcrumb') && is_single() ) : ?>
<?php endif; ?>
You can see what it currently looks like on a post page through the website URL provided for admins.
Any advice on what I may be doing wrong?
I ended up getting it to show with shortcode. I would rather get it to work with standard code, but if it's not possible that's fine. With shortcodes it seems to displaying all the way to the left. Anyway to fix that?
So after some experimentation, I like the before main content hook location, but I'm still having trouble getting anything other than shortcode to work, which would be fine but it doesn't seem like shortcodes provide a css class. I'll leave my site with the php code I found (mentioned above) so you can see what's happening.
Hi there,
Try this code:
<?php
if ( function_exists( 'yoast_breadcrumb' ) ) {
yoast_breadcrumb( '<p id="breadcrumbs">', '</p>' );
}
?>
Then be sure to check the "Execute PHP" checkbox.
That should fix it :)