Hi @designerken,
Base on your given code and result, it will just add a new item but not really override the default one. Customizing breadcrumbs is a complex coding but if you want to have a simple solution, please follow the steps below.
First Solution:
Instead of inserting the CPT title after the home icon, I suggest that you hide the default breadcrumbs by using display: none; in CSS. Then create your own breadcrumbs, so you need to re-structure your HTML to have the same output with the breadcrumbs.
Second Solution:
If you don’t want to hide the breadcrumbs due to HTML DOM issues, I suggest instead create your own breadcrumbs using a shortcode. See the example code below:
Note: This will require a layout builder to make it work because you are going to add the shortcode inside the text element.
function my_custom_breadcrumbs() {
$home_link = home_url();
$page_title = get_the_title();
// Custom Post Type Practice Area
if ( is_singular( 'practice-areas' ) ) {
$attorney_url = $home_link .'/practice-areas';
$attorney_title = 'Practice Areas' ;
$attorney_link = '<a href="'. $attorney_url . '">' . $attorney_title . '</a>';
echo $attorney_link.'<span class="x-crumbs-delimiter">→</span>'. $page_title;
}
}
add_shortcode( 'x_breadcrumbs_data', 'my_custom_breadcrumbs')
Then in your layout builder, you should call this function [x_breadcrumbs_data]
Please note that providing custom code is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third-party developer or you can avail One where we can answer questions outside of the features of our theme.
Hope that helps.
Thank you.