Yoast’s WordPress SEO plugin includes breadcrumbs which require manual installation of a template tag.
After installing the plugin, go to Internal Links and enable Breadcrumbs:
Once you’ve enabled breadcrumbs, you can install a few lines of PHP code.
There’s 2 ways to install the breadcrumbs template tag:
You can:
- Add the template tag directly to your themes template file like your single.php file
- Or you can hook in the tag using a custom function.
Yoast’s Breadcrumbs Template Tag
The 1st method requires you paste the template tag in the position in your themes template file where you want the breadcrumbs to display.
Yoast’s Breadcrumbs Custom Function
The 2nd method requires you to paste this code into your child themes functions file and modify the conditional tag and/or hook position to suit your own requirements.
The loop_start hook will work in any theme however you can replace it with any theme specific hook or WooCommerce hook.
Yoast’s Breadcrumbs On CPT’s
If you want to display Yoasts breadcrumbs on single CPT’s or custom taxonomy types, simply replace the cpt-name in the following code with the name of your custom post type:
Or, you can use the previous code and the WordPress SEO plugin settings for posts types and taxonomy types without adding any conditional tags to the code:
This tutorial is based on this forum question:
I’m using the yoast SEO plugin, and my breadcrumbs aren’t displaying anywhere on my woocommerce website or my blog pages.
I have the following settings turned on for the plugin;
Enable Breadcrumbs checked
Posts Taxonomy: Category
Products Taxonomy: Product Category
Post Type Archive: Product Category: Products
But the breadcrumbs aren’t appearing. Does anyone have any suggestions to help me get the breadcrumbs to display?
Leave a Reply