[Support request] Trying to add breadcrumbs to post pages

Home Forums Support [Support request] Trying to add breadcrumbs to post pages

Home Forums Support Trying to add breadcrumbs to post pages

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #702672
    Kevin

    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 yoast_breadcrumb( ‘<p id=”breadcrumbs”>’,'</p>’ ); ?>

    <?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?

    GeneratePress 2.1.4
    GP Premium 1.7.2
    #702675
    Kevin

    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?

    #702699
    Kevin

    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.

    #702750
    Tom
    Lead Developer
    Lead Developer

    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 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.