-
AuthorPosts
-
May 20, 2016 at 10:33 am #1001670
HI,
Oh, sorry for confusion. However, I have an active child theme. At least it says so in Appearance settings: “Active: X β Child Theme”
May 20, 2016 at 5:03 pm #1002167Hi Janih,
Kindly post a new thread and provide us with the following details so that we could check this further:
– Link to your site
– WordPress Admin username / password
– FTP credentialsDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
July 7, 2016 at 5:40 am #1076246Hi Christopher,
I used the code from your post (https://community.theme.co/forums/topic/how-to-feature-product-category-in-breadcrumbs/page/2/#post-764836) and it almost works. It seems like it doesn’t give me a complete breadcrumb that includes all sub categories. For example…
http://website.com/shop/category/ produces ‘home > shop > category’ which is right
http://website.com/shop/category/sub-category/ produces ‘home > shop > sub category’ which is wrong as it misses out the parent category.
I will the breadcrumb to go deeper than above examples so can you help?
Many thanks,
AdamJuly 7, 2016 at 7:41 pm #1077145Hi there,
The code only displays one category at a time. It needs more complex coding in order to display nested categories. A product can have multiple categories times the amount of child they have. Unfortunately, we can’t provide further customization. I tried it, but become more complex. You may also try 3rd party breadcrumbs that support woocommerce, you can simply replace the code with another code.
Eg.
if ( $v = get_breadcrumb_category('product_cat') ) { $product_category = get_3rd_party_breadcrumb(); } else { $product_category = ''; }
Thanks!
August 24, 2016 at 7:45 am #1144618+1 vote for proper breadcrumbs feature π
August 24, 2016 at 11:31 am #1144927Thanks for your input!
Your vote has been counted.
Joao
October 14, 2016 at 1:49 pm #1216478I’ll also “vote” for breadcrumbs to work correctly properly for multi-level categories. Until then, this works for the category archive page and for single ‘post’ (ie. the ‘post’ type) pages only; rtl is untested, but probably works (copy get_breadcrumb_category() from earlier example):
function x_breadcrumbs() { if ( x_get_option( 'x_breadcrumb_display', '1' ) ) { GLOBAL $post; $is_ltr = ! is_rtl(); $stack = x_get_stack(); $delimiter = x_get_breadcrumb_delimiter(); $home_text = x_get_breadcrumb_home_text(); $home_link = home_url(); $current_before = x_get_breadcrumb_current_before(); $current_after = x_get_breadcrumb_current_after(); $page_title = get_the_title(); $blog_title = get_the_title( get_option( 'page_for_posts', true ) ); $post_parent = $post->post_parent; if ( X_WOOCOMMERCE_IS_ACTIVE ) { $shop_url = x_get_shop_link(); $shop_title = x_get_option( 'x_' . $stack . '_shop_title', __( 'The Shop', '__x__' ) ); $shop_link = '<a href="'. $shop_url .'">' . $shop_title . '</a>'; } echo '<div class="x-breadcrumbs">'; if ( $is_ltr ) { echo '<a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter; } if ( is_home() ) { echo $current_before . $blog_title . $current_after; } elseif ( is_category() ) { $cat = get_category( get_query_var( 'cat' ), false ); $parent_id = ( $cat !== null ) ? $cat->parent : false; $breadcrumbs = array(); if ( is_rtl() ) { echo $current_before . single_cat_title( '', false ) . $current_after; } while ( $parent_id ) { $parent = get_category( $parent_id ); if ( $parent !== null ) { // does this parent also have a parent? $cat = get_category( $parent_id, false ); $parent_id = ( $cat !== null && $cat->parent != 0 ) ? $cat->parent : false; $parent = sanitize_category( $parent ); $breadcrumbs[] = '<a href="' . get_category_link( $parent->term_id ) . '">' . $parent->name . '</a>'; } } if ( $is_ltr ) { $breadcrumbs = array_reverse( $breadcrumbs ); } for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) { if ( $is_rtl ) echo $delimiter; echo $breadcrumbs[$i]; if ( $is_ltr ) echo $delimiter; } if ( $is_ltr ) { echo $current_before . single_cat_title( '', false ) . $current_after; } } elseif ( x_is_product_category() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . single_cat_title( '', false ) . $current_after; } else { echo $current_before . single_cat_title( '', false ) . $current_after . $delimiter . $shop_link; } } elseif ( x_is_product_tag() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . single_tag_title( '', false ) . $current_after; } else { echo $current_before . single_tag_title( '', false ) . $current_after . $delimiter . $shop_link; } } elseif ( is_search() ) { echo $current_before . __( 'Search Results for ', '__x__' ) . 'β' . get_search_query() . 'β' . $current_after; } elseif ( is_singular( 'post' ) ) { $cat = get_the_category(); $cat = get_category( $cat[0], false ); $category_id = $cat->term_id; $breadcrumbs = array(); if ( is_rtl() ) { echo $current_before . $page_title . $current_after; } while ( $category_id ) { $cat = get_category( $category_id ); if ( $cat !== null ) { // Loop through parent categories $category_id = ( $cat !== null && $cat->parent != 0 ) ? $cat->parent : false; $cat = sanitize_category( $cat ); $breadcrumbs[] = '<a href="' . get_category_link( $cat->term_id ) . '">' . $cat->name . '</a>'; } } if ( $is_ltr ) { $breadcrumbs = array_reverse( $breadcrumbs ); } for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) { if ( $is_rtl ) echo $delimiter; echo $breadcrumbs[$i]; if ( $is_ltr ) echo $delimiter; } if ( $is_ltr ) { echo $current_before . $page_title . $current_after; } } elseif ( x_is_portfolio() ) { echo $current_before . get_the_title() . $current_after; } elseif ( x_is_portfolio_item() ) { $link = x_get_parent_portfolio_link(); $title = x_get_parent_portfolio_title(); if ( $v = get_breadcrumb_category('portfolio-category') ) { $portfolio_category = $delimiter . $v; } else { $portfolio_category = ''; } if ( $is_ltr ) { echo '<a href="' . $link . '">' . $title . '</a>' . $portfolio_category . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $portfolio_category . $delimiter . '<a href="' . $link . '">' . $title . '</a>'; } } elseif ( x_is_product() ) { if ( $v = get_breadcrumb_category('product_cat') ) { $product_category = $delimiter . $v; } else { $product_category = ''; } if ( $is_ltr ) { echo $shop_link . $product_category . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $product_category . $delimiter . $shop_link; } } elseif ( x_is_buddypress() ) { if ( bp_is_group() ) { echo '<a href="' . bp_get_groups_directory_permalink() . '">' . x_get_option( 'x_buddypress_groups_title', __( 'Groups', '__x__' ) ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } elseif ( bp_is_user() ) { echo '<a href="' . bp_get_members_directory_permalink() . '">' . x_get_option( 'x_buddypress_members_title', __( 'Members', '__x__' ) ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } else { echo $current_before . x_buddypress_get_the_title() . $current_after; } } elseif ( x_is_bbpress() ) { remove_filter( 'bbp_no_breadcrumb', '__return_true' ); if ( bbp_is_forum_archive() ) { echo $current_before . bbp_get_forum_archive_title() . $current_after; } else { echo bbp_get_breadcrumb(); } add_filter( 'bbp_no_breadcrumb', '__return_true' ); } elseif ( is_page() && ! $post_parent ) { echo $current_before . $page_title . $current_after; } elseif ( is_page() && $post_parent ) { $parent_id = $post_parent; $breadcrumbs = array(); if ( is_rtl() ) { echo $current_before . $page_title . $current_after . $delimiter; } while ( $parent_id ) { $page = get_page( $parent_id ); $breadcrumbs[] = '<a href="' . get_permalink( $page->ID ) . '">' . get_the_title( $page->ID ) . '</a>'; $parent_id = $page->post_parent; } if ( $is_ltr ) { $breadcrumbs = array_reverse( $breadcrumbs ); } for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) { echo $breadcrumbs[$i]; if ( $i != count( $breadcrumbs ) -1 ) echo $delimiter; } if ( $is_ltr ) { echo $delimiter . $current_before . $page_title . $current_after; } } elseif ( is_tag() ) { echo $current_before . single_tag_title( '', false ) . $current_after; } elseif ( is_author() ) { GLOBAL $author; $userdata = get_userdata( $author ); echo $current_before . __( 'Posts by ', '__x__' ) . 'β' . $userdata->display_name . $current_after . 'β'; } elseif ( is_404() ) { echo $current_before . __( '404 (Page Not Found)', '__x__' ) . $current_after; } elseif ( is_archive() ) { if ( x_is_shop() ) { echo $current_before . $shop_title . $current_after; } else { echo $current_before . __( 'Archives ', '__x__' ) . $current_after; } } if ( $is_rtl ) { echo $delimiter . '<a href="' . $home_link . '">' . $home_text . '</a>'; } echo '</div>'; } }
October 14, 2016 at 10:18 pm #1216962Noted that! Yes, it would be a very nice feature.
November 12, 2016 at 5:07 am #1254304Hi,
I also like to see sub categories breadcrumbs. Is the feature added ?Thanks,
FΔ±rat
November 12, 2016 at 5:40 am #1254329Me too. I have 2 web sites with x theme and both need this functionality.
November 12, 2016 at 6:49 am #1254357Hi there,
It’s not yet implemented, but it’s on our list. Please stay tuned π
Thanks!
December 7, 2016 at 7:22 am #1284536I am assuming this hasn’t been resolved and none of the solutions I find fix it either, so a year later adding a +1 to the feature request. Shop breadcrumbs are a key customer navigation tool. They drill down and want to drill back up without using a browser back key esp on mobile.
December 7, 2016 at 8:38 am #1284623Hello There,
Thank you for adding the thread. I have update the request for this. We will let you know once we have an update.
February 17, 2017 at 11:27 am #1375304Here 1+ for this feature too.
Several commercial website projects running x theme need product categories within breadcrumbs.February 17, 2017 at 7:48 pm #1375842We appreciate your feedback! We have forwarded this to our developers already.
Once they’ll have this resolve, it will be updated and rolled out in our next update release. -
AuthorPosts