woocommerce_get_breadcrumb filter in class

Closes #7644
This commit is contained in:
Mike Jolley 2015-03-09 10:17:31 +00:00
parent 1a51989420
commit 899952e478
1 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ class WC_Breadcrumb {
* @return array
*/
public function get_breadcrumb() {
return $this->crumbs;
return apply_filters( 'woocommerce_get_breadcrumb', $this->crumbs, $this );
}
/**
@ -144,7 +144,7 @@ class WC_Breadcrumb {
if ( 'product' === get_post_type( $post ) ) {
$this->prepend_shop_page();
if ( $terms = wc_get_product_terms( $post->ID, 'product_cat', array( 'orderby' => 'parent', 'order' => 'DESC' ) ) ) {
$main_term = apply_filters('woocommerce_breadcrumb_main_term', $terms[0], $terms);
$main_term = apply_filters( 'woocommerce_breadcrumb_main_term', $terms[0], $terms );
$this->term_ancestors( $main_term->term_id, 'product_cat' );
$this->add_crumb( $main_term->name, get_term_link( $main_term ) );
}