stuart-d
8/9/2012 - 10:55 PM

woo custom single post breadcrumbs

woo custom single post breadcrumbs

add_filter( 'woo_breadcrumbs_args', 'woo_custom_single_post_breadcrumbs', 10, 1);
add_filter( 'woo_breadcrumbs_trail', 'woo_custom_single_post_breadcrumbs', 10, 1);

function woo_custom_single_post_breadcrumbs( $crumbs ) {


	if ( is_singular() && ( 'post' == get_post_type() ) ) {
	$crumbs['separator'] = '|'; // Separator change to pipe		
	$category = get_the_category();
	$category_link = '<a href="' . get_category_link( $category[0]->term_id ) . '" title="'. $category[0]->name .'">'. $category[0]->name .'</a>';		
	array_splice( $crumbs, 1, count( $crumbs ) - 1, array( $category_link, $crumbs['trail_end'] ) );
	}
	
	return $crumbs;		
}