Basic Breadcrumbs

Recently we made a site that needed breadcrumbs but was used as an internal portal. This means it didn’t need any SEO stuff so the standard Yoast breadcrumbs we use seemed like overkill.

Decided to create a couple simple functions to display our breadcrumbs.

By sticking those two functions in your functions.php file and then calling jb_breadcrumbs() wherever you want to display these breadcrumbs you should be all set.

Yoast Shorten Breadcrumbs

We use the Yoast SEO plugin a lot. Because we already use their SEO features we also use their breadcrumb option, it is pretty nice.

Anyway, Sometimes a client will have titles that are too long. I am talking, like, way too long. Anyway, these long titles can wreak havoc on our breadcrumbs. We need to find a way to shorten these titles to something more reasonable. Here we go!

There we go! Now all of our titles will be shortened to 24 characters + an ellipses.

Extending the functionality of Yoast breadcrumbs

I use Custom Post Types in basically every site I make. I also use the Yoast SEO plugin on almost every site I make. I also try and use Yoast SEO Breadcrumbs on every site.

Yoast isn’t a perfect solution though and their breadcumbs are about as basic as it gets. Which is great for regular blogs or sites with normal / logical urls…unfortunately not every site is going to work like this.

Often, I will need to change the url of a post type so that it has a standard page for the parent of the post types. This requires a few steps.

First, make sure to setup the correct rewrites for your CPT like so:

This will now change your default CPT url structure. Which is awesome, but the Yoast breadcrumbs do not take this into account (and why would it?). So we need to hook into one of the Breadcrumbs filters and edit it’s link structure. Like so:

This will now follow your custom link structure up to your highest parent page.

A big thanks to Steve Taylor for the majority of this code.