Breadcrumb Code, little problem

Hi, I am using the below code in my functions file. Problem is it has 2 links to the home page in it, so it will be like HOME >LEARN ENGLISH> SUBJECT> IDIOMS the first home is the little house icon, is it possible to remove the second link which is the ‘blog title’, not sure why it is even there. if I leave it blank then it ends up > >

    add_filter('x_breadcrumbs_data', 'post_parent_trail', 9999999, 2);

	function post_parent_trail ($crumbs, $args) {
		if ( is_singular('post') ) {

			$category = get_the_category( get_the_ID() );

				if ( count( $category ) > 0 ) {

					$cat_array = array();
					$cat_array[1]['label'] = $category[0]->name;
					$cat_array[1]['url'] = get_category_link( $category[0]->term_id );

					array_splice($crumbs, 2, 0, $cat_array);
				}
		}
	return $crumbs;  
}

Hello @GGMM,

Thanks for writing in!

The Blog Title cannot be removed because it is built in the breadcrumb. The code you have added only injects the category of the post item. You have the same home link because your homepage is also your blog index. Please go to Pages and create a new page entitled “Blog”. Go to Settings > Reading > Front Page Displays and select the page for your front page and the posts page. And then the result will have:

 HOME > Blog Title > Category > Post Title

where:

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.