Breadcrumbs on archive.php

Hey,

I have a problem with breadcrumbs on archive.php page. The last breadcrumb it displays is a last post. It should only display name of archive. Should loop be formated somewhat different?
Attaching screenshots:


Thanks for reading!

I am having the same issue, does anyone know how to get this to stop happening.

Hello, a quick fix for this is to add an if statement to the element that has the breadcrumb to show only if not the archive page and then in the else element below it output a hand written breadcrumb for the archive page.

2 Likes

I followed logic from jonroc. It worked for me. I added PHP code action on breadcrumb elements and pasted this code:

… without PHP tags!

You just have to add IF statment before the rest of the code. You must write it out. I found it worked best if I use PHP code action.

This is code generated with Breadcrumbs action only.

Thanks @veras @jonroc!

I changed the PG_Helper::getBreadcrumbs function so that it only adds the current post if is_singular() is true.

Note, when this is out in the next release, your custom code won’t work correctly, because it will remove the category from the returned array.

1 Like

Thank you!
Will have that in mind.

1 Like