Fix extra delimiter in breadcrumbs Closes #6153

This commit is contained in:
Mike Jolley 2014-09-04 10:17:19 +01:00
parent 40c528dc3a
commit 20407c8cc0
1 changed files with 5 additions and 4 deletions

View File

@ -5,6 +5,7 @@
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.2.0 * @version 2.2.0
* @see woocommerce_breadcrumb()
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -31,7 +32,7 @@ if ( ( ! is_front_page() && ! ( is_post_type_archive() && get_option( 'page_on_f
echo $before . '<a class="home" href="' . apply_filters( 'woocommerce_breadcrumb_home_url', home_url() ) . '">' . $home . '</a>' . $after . $delimiter; echo $before . '<a class="home" href="' . apply_filters( 'woocommerce_breadcrumb_home_url', home_url() ) . '">' . $home . '</a>' . $after . $delimiter;
} }
if( is_home() ) { if ( is_home() ) {
echo $before . single_post_title('', false) . $after; echo $before . single_post_title('', false) . $after;
@ -43,7 +44,7 @@ if ( ( ! is_front_page() && ! ( is_post_type_archive() && get_option( 'page_on_f
if ( 0 != $this_category->parent ) { if ( 0 != $this_category->parent ) {
$parent_category = get_category( $this_category->parent ); $parent_category = get_category( $this_category->parent );
if ( ( $parents = get_category_parents( $parent_category, TRUE, $after . $delimiter . $before ) ) && ! is_wp_error( $parents ) ) { if ( ( $parents = get_category_parents( $parent_category, TRUE, $after . $delimiter . $before ) ) && ! is_wp_error( $parents ) ) {
echo $before . $parents . $after . $delimiter; echo $before . trim( $parents, $after . $delimiter . $before ) . $after . $delimiter;
} }
} }
@ -144,7 +145,7 @@ if ( ( ! is_front_page() && ! ( is_post_type_archive() && get_option( 'page_on_f
$cat = current( get_the_category() ); $cat = current( get_the_category() );
if ( ( $parents = get_category_parents( $cat, TRUE, $after . $delimiter . $before ) ) && ! is_wp_error( $parents ) ) { if ( ( $parents = get_category_parents( $cat, TRUE, $after . $delimiter . $before ) ) && ! is_wp_error( $parents ) ) {
echo $before . $parents . $after . $delimiter; echo $before . trim( $parents, $after . $delimiter . $before ) . $after . $delimiter;
} }
echo $before . get_the_title() . $after; echo $before . get_the_title() . $after;
@ -168,7 +169,7 @@ if ( ( ! is_front_page() && ! ( is_post_type_archive() && get_option( 'page_on_f
$cat = get_the_category( $parent->ID ); $cat = get_the_category( $parent->ID );
$cat = $cat[0]; $cat = $cat[0];
if ( ( $parents = get_category_parents( $cat, TRUE, $after . $delimiter . $before ) ) && ! is_wp_error( $parents ) ) { if ( ( $parents = get_category_parents( $cat, TRUE, $after . $delimiter . $before ) ) && ! is_wp_error( $parents ) ) {
echo $before . $parents . $after . $delimiter; echo $before . trim( $parents, $after . $delimiter . $before ) . $after . $delimiter;
} }
echo $before . '<a href="' . get_permalink( $parent ) . '">' . $parent->post_title . '</a>' . $after . $delimiter; echo $before . '<a href="' . get_permalink( $parent ) . '">' . $parent->post_title . '</a>' . $after . $delimiter;
echo $before . get_the_title() . $after; echo $before . get_the_title() . $after;