Stepholt News

PHP Code for Yoast Breadcrumbs

News Categories: TechWordpress

This article was published on: 11/7/22 8:34 PM

We get asked by clients as a feature to ensure that breadcrumbs are part of the UX/UI on the new website build and the one thing which isn’t common knowledge is how to add it to the wordpress theme’s php. As Yoast is the number one plugin for Search Engine Optimisation on WordPress, we do not build a website without it installed.

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

The above code can be copied and inserted into your theme’s header files (if that’s where you would like to display it)

Tweak Yoast Breadcrumbs

Don’t forget to customise the styling of the Yoast Breadcrumb under the plugin’s settings section: Yoast > Search Appearance > Breadcrumbs

If coding isn’t for you, adding a shortcode will work the same but depending on the theme structure you may need to add it to all the pages one by one.

Home / PHP Code for Yoast Breadcrumbs

 

Website Design
Website Development
Website Marketing