Site logo

Archived topic

Where install Yoast Breadcrumb code?

9 replies · Started by Harvey on July 9, 2017

Viewing posts 1–10 of 10

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

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.

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

Sounds good, I'll be here :)

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?

What is wrong?

I don’t know... maybe something in the php syntax, code snippets don’t like it :)

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

Like do you want them on every page?

Thanks!

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

This archived topic is closed to new replies.