[Support request] Where install Yoast Breadcrumb code?

Home Forums Support [Support request] Where install Yoast Breadcrumb code?

Home Forums Support Where install Yoast Breadcrumb code?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #346591
    Harvey

    As you’ve suggested, I’ve disabled executing PHP execution from the Dashboard. I had the Yoast Breadcrumb code in GP Hooks after the header. Moving it to functions.php didn’t work (as Yoast said it wouldn’t). I’ve been thru the GP docs and searched the GP suppport forum, and I’m still unsure where to put it. I’d rather not copy header.php into the child theme folder in case it gets updated. Any suggestions?

    Harvey

    #346748
    Tom
    Lead Developer
    Lead Developer

    Hi Harvey,

    Try this:

    add_action( 'generate_after_header', 'tu_add_yoast_bc' );
    function tu_add_yoast_bc() {
    ?>
        Your Yoast breadcrumbs code in here
    <?php
    }

    This can go in your child theme functions.php, or a custom plugin.

    #347138
    Harvey

    Thank you so much. It’s good someone knows all the d**n function calls!

    I’ve followed your advice — don’t see the breadcrumbs yet. Will play around a bit and contact you again if necessary.

    Harvey

    #347166
    Tom
    Lead Developer
    Lead Developer

    Sounds good, I’ll be here 🙂

    #466838
    Gabriele

    Hi there,
    I’m trying to do the same but there is something wrong with my code:

    add_action( 'generate_after_header', 'dev_add_yoast_breadcrumbs' );
    function dev_add_yoast_breadcrumbs() {
    	?> if ( function_exists('yoast_breadcrumb') && ! is_front_page() ) {
        	yoast_breadcrumb( '<p id=”breadcrumbs”>','</p>' ); } <?php
    	?> endif; <?php
    }

    Please can you help me?

    #466954
    Leo
    Staff
    Customer Support

    What is wrong?

    #467004
    Gabriele

    I don’t know… maybe something in the php syntax, code snippets don’t like it 🙂

    #467122
    Leo
    Staff
    Customer Support

    Can you open a new topic and specify your condition for the breadcrumb?

    Like do you want them on every page?

    Thanks!

    #467136
    Gabriele

    The condition is already correct, the problem is simply the php syntax (brackets or something like that).
    I’m not a coder so I have made some mistake but I don’t know where…

    #467197
    Leo
    Staff
    Customer Support

    Try the code here in Appearance > GP Hooks > After Header:
    https://generatepress.com/forums/topic/trying-to-enable-breadcrumbs-yoast-seo/#post-416405

    and make sure execute PHP is checked.

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