Site logo

Archived topic

Remove article title from breadcrumbs

14 replies · Started by Rob on March 15, 2021

Viewing posts 1–15 of 15

A while ago I successfully added breadcrumbs to my GP theme and I was happy with the way they appeared.

However, about 6 weeks ago the title of the blog posts started appearing in the breadcrumbs, as shown below:
https://robpowellbizblog.com/wp-content/uploads/2021/03/remove_breadcrumbs.jpg

This is annoying as it duplicates the existing article title (it could also be viewed by search engines as an attempt to spam the search results).

My question is: how do I edit the breadcrumb code so that the title of the article does not form part of the breadcumb?

Thanks for your help,

Rob

Hi there,

Aside from the current question, the breadcrumbs actually duplicate twice as shown here:
https://share.getcloudapp.com/DOu2Ob4g

One added on the supposed div where the title should've been added and one within the Thrive Editor.

Can you tell us how the Breadcrumbs is inserted? So we have an idea of how the breadcrumb is structured/generated.

Let us know.

Thanks for the reply.

That second duplication was the result of me testing a shortcode, which I've now removed:
https://robpowellbizblog.com/quizzes-for-lead-generation/

I can't remember exactly where I added the code for the breadcrumbs. Is there an 'inspector tool' where you can hover the mouse over the element and it will tell you where the code snippet is (i.e what the WP file is that contains the code)? If so, that is what I would need in order to work out where the code is.

This is the GP element that I am using as the 'hook':
https://robpowellbizblog.com/wp-content/uploads/2021/03/GP_Elements.jpg

Thanks for your help,
Rob

I can’t remember exactly where I added the code for the breadcrumbs. Is there an ‘inspector tool’ where you can hover the mouse over the element and it will tell you where the code snippet is (i.e what the WP file is that contains the code)? If so, that is what I would need in order to work out where the code is.

While we can inspect the page and find clues, there are occurrences when the element gives too little to be able to actually identify which code it's coming from. (no classes, no HTML comments)

But here's a quick fix to your concern.

We can actually just hide the title on the breadcrumbs from displaying through CSS.

Try this:

strong.breadcrumb_last {
    display: none;
}

Nice one. Glad you got it sorted.

Thanks, all resolved now :)

I pasted this into my simple css plugin which I thought would activate it but it did not remove the title from my Yoast breadcrumbs.

Thanks.

strong.breadcrumb_last {
display: none;
}

I've seen this as a proposed solution to removing the title as well but I don't think it's CSS so I don't know if it's safe to use it.

/* Put in myfunctions.php
* Remove the last breadcrumb, the post title, from the Yoast SEO breadcrumbs
* Previous breadcrumb will remain linked
* Credit: David @ https://generatepress.com/forums/topic/how-to-hide-the-title-part-in-the-breadcrumb-im-using-yoast-seo/#post-614239
* Last Tested: Apr 11 2020 using Yoast SEO 13.4.1 on WordPress 5.4
*/

add_filter('wpseo_breadcrumb_single_link', 'remove_breadcrumb_title' );
function remove_breadcrumb_title( $link_output) {
if(strpos( $link_output, 'breadcrumb_last' ) !== false ) {
$link_output = '';
}
return $link_output;
}

Hi Charles,

That second snippet is PHP - this article explains how to add the code to your site:

https://docs.generatepress.com/article/adding-php/

TLDR: If you're using a Child Theme then add the code to the Child Themes functions.php file - if you're not using a Child Theme then install the Code Snippets plugin, add a new Snippet and paste the code in and save it.

Neither seem to remove the title from my crumbs.

That's a YoastSEO filter so you will need to check with their support on why it's not working.

I can't really comment on what's the best option as it's more about personal preference.

Please make sure to reply to the forum topic here and start a new topic if you need further help with this.

Thanks!

Worked for me when I removed .strong leaving the css code to:

.breadcrumb_last {
display: none;
}

Thanks for sharing!

This archived topic is closed to new replies.