post_name ) && get_option( 'page_on_front' ) !== $shop_page_id ) { $prepend = $before . '' . $shop_page->post_title . ' ' . $after . $delimiter; } if ( ( ! is_home() && ! is_front_page() && ! ( is_post_type_archive() && get_option( 'page_on_front' ) == wc_get_page_id( 'shop' ) ) ) || is_paged() ) { echo $wrap_before; if ( ! empty( $home ) ) { echo $before . '' . $home . '' . $after . $delimiter; } if ( is_category() ) { $cat_obj = $wp_query->get_queried_object(); $this_category = get_category( $cat_obj->term_id ); if ( $this_category->parent != 0 ) { $parent_category = get_category( $this_category->parent ); echo get_category_parents($parent_category, TRUE, $delimiter ); } echo $before . single_cat_title( '', false ) . $after; } elseif ( is_tax('product_cat') ) { echo $prepend; $current_term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $ancestors = array_reverse( get_ancestors( $current_term->term_id, get_query_var( 'taxonomy' ) ) ); foreach ( $ancestors as $ancestor ) { $ancestor = get_term( $ancestor, get_query_var( 'taxonomy' ) ); echo $before . '' . esc_html( $ancestor->name ) . '' . $after . $delimiter; } echo $before . esc_html( $current_term->name ) . $after; } elseif ( is_tax( 'product_tag' ) ) { $queried_object = $wp_query->get_queried_object(); echo $prepend . $before . __( 'Products tagged “', 'woocommerce' ) . $queried_object->name . '”' . $after; } elseif ( is_day() ) { echo $before . '' . get_the_time( 'Y' ) . '' . $after . $delimiter; echo $before . '' . get_the_time( 'F' ) . '' . $after . $delimiter; echo $before . get_the_time( 'd' ) . $after; } elseif ( is_month() ) { echo $before . '' . get_the_time( 'Y' ) . '' . $after . $delimiter; echo $before . get_the_time( 'F' ) . $after; } elseif ( is_year() ) { echo $before . get_the_time( 'Y' ) . $after; } elseif ( is_post_type_archive( 'product' ) && get_option( 'page_on_front' ) !== $shop_page_id ) { $_name = wc_get_page_id( 'shop' ) ? get_the_title( wc_get_page_id( 'shop' ) ) : ''; if ( ! $_name ) { $product_post_type = get_post_type_object( 'product' ); $_name = $product_post_type->labels->singular_name; } if ( is_search() ) { echo $before . '' . $_name . '' . $delimiter . __( 'Search results for “', 'woocommerce' ) . get_search_query() . '”' . $after; } elseif ( is_paged() ) { echo $before . '' . $_name . '' . $after; } else { echo $before . $_name . $after; } } elseif ( is_single() && ! is_attachment() ) { if ( get_post_type() == 'product' ) { echo $prepend; if ( $terms = wc_get_product_terms( $post->ID, 'product_cat', array( 'orderby' => 'parent', 'order' => 'DESC' ) ) ) { $main_term = $terms[0]; $ancestors = get_ancestors( $main_term->term_id, 'product_cat' ); $ancestors = array_reverse( $ancestors ); foreach ( $ancestors as $ancestor ) { $ancestor = get_term( $ancestor, 'product_cat' ); if ( ! is_wp_error( $ancestor ) && $ancestor ) echo $before . '' . $ancestor->name . '' . $after . $delimiter; } echo $before . '' . $main_term->name . '' . $after . $delimiter; } echo $before . get_the_title() . $after; } elseif ( get_post_type() != 'post' ) { $post_type = get_post_type_object( get_post_type() ); $slug = $post_type->rewrite; echo $before . '' . $post_type->labels->singular_name . '' . $after . $delimiter; echo $before . get_the_title() . $after; } else { $cat = current( get_the_category() ); echo get_category_parents( $cat, true, $delimiter ); echo $before . get_the_title() . $after; } } elseif ( is_404() ) { echo $before . __( 'Error 404', 'woocommerce' ) . $after; } elseif ( ! is_single() && ! is_page() && get_post_type() != 'post' ) { $post_type = get_post_type_object( get_post_type() ); if ( $post_type ) echo $before . $post_type->labels->singular_name . $after; } elseif ( is_attachment() ) { $parent = get_post( $post->post_parent ); $cat = get_the_category( $parent->ID ); $cat = $cat[0]; echo get_category_parents( $cat, true, '' . $delimiter ); echo $before . '' . $parent->post_title . '' . $after . $delimiter; echo $before . get_the_title() . $after; } elseif ( is_page() && !$post->post_parent ) { echo $before . get_the_title() . $after; } elseif ( is_page() && $post->post_parent ) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ( $parent_id ) { $page = get_page( $parent_id ); $breadcrumbs[] = '' . get_the_title( $page->ID ) . ''; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse( $breadcrumbs ); foreach ( $breadcrumbs as $crumb ) echo $crumb . '' . $delimiter; echo $before . get_the_title() . $after; } elseif ( is_search() ) { echo $before . __( 'Search results for “', 'woocommerce' ) . get_search_query() . '”' . $after; } elseif ( is_tag() ) { echo $before . __( 'Posts tagged “', 'woocommerce' ) . single_tag_title('', false) . '”' . $after; } elseif ( is_author() ) { $userdata = get_userdata($author); echo $before . __( 'Author:', 'woocommerce' ) . ' ' . $userdata->display_name . $after; } if ( get_query_var( 'paged' ) ) echo ' (' . __( 'Page', 'woocommerce' ) . ' ' . get_query_var( 'paged' ) . ')'; echo $wrap_after; }