Site logo

Archived topic

How to add breadcrumb to every page with php code

9 replies · Started by amiee on March 2, 2021

Viewing posts 1–10 of 10

Hi, there
Sorry for disturbing.
May I know how to add breadcrumb to every page with php code, or breadcrumb can be showed on every page without code?

Looking forward to your reply.

Thanks and regards

Thanks for your reply soon.
But I don't know add the code SEO given to which place, need to use plugin, or in theme editor directly, which file?
would you like to let me know?

The code"<?php
如果(function_exists('yoast_breadcrumb')){
yoast_breadcrumb('<p id =“ breadcrumbs”>','</ p>');
}
?>"

Thanks and regards

And I added to the end of header Theme Header php, now the post time and breadcrumb appeared on the same line? Why?

So how to do?

Thanks and regards

<?php
if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb( '<p id="breadcrumbs">','</p>' );
}
?>

The code is above.

Looking forward to your reply.

Thanks and regards

I added the code“
add_action( 'generate_after_header', function() {
if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb( '

<p id="breadcrumbs">','</p>

' );
}
} );

to the snippets plugin and Worked it out.
But a little trouble, breadcrumb showed on the front page though excluded the fornt page.

Thanks and Regards

Regards

Hi there,

change the snippet to:

add_action( 'generate_after_header', function() {
    if ( ! is_front_page() && function_exists('yoast_breadcrumb') ) {
        yoast_breadcrumb( '<div class="grid-container grid-parent"><p id="breadcrumbs">','</p></div>' );
    }
} );

Hi, there

Everything is ok after I changed the code according to your help.

Thank you so much.

Regards

Glad we could be of help.

This archived topic is closed to new replies.