Home / Admin / Change the HTML template for a specific crumb in the breadcrumbs trail
Duplicate Snippet

Embed Snippet on Your Site

Change the HTML template for a specific crumb in the breadcrumbs trail

This snippet can be used to change the HTML if it’s the crumb of the ‘uncategorized’ category. This change will remove the link to that category.

10+
Code Preview
php
<?php
add_filter( 'aioseo_breadcrumbs_template', 'aioseo_breadcrumbs_template', 10, 2 );
function aioseo_breadcrumbs_template( $templateItem, $crumb ) {
	if ( is_a( $crumb['reference'], 'WP_Term' ) && 'uncategorized' === $crumb['reference']->slug ) {
		$templateItem['template'] = '<span class="aioseo-breadcrumb">
			#breadcrumb_label
		</span>';
	}
	return $templateItem;
}

Comments

Add a Comment