-
AuthorPosts
-
November 21, 2014 at 9:35 am #149943
HI,
I am putting together a furniture website using various categories and tags via the woocommerce shop plugin. I have named my shop as “collection”. When I click on it collection shows in the breadcrumbs and if I make a category selection that is included to. Like this;
Home > Collection > Mirrors
If one of the mirrors is selected the breadcrumb loses the category, like this;
Home > Collection > George III Adam Oval Mirror
How can I make it show this?
Home > Collection > Mirrors > George III Adam Oval Mirror
Thanks in advance for your great support.
Regards,
Mark
November 22, 2014 at 4:08 am #150376Hi there,
Please switch to default wordpress theme and check if woocommerce breadcrumbs act differently or not?
Let us know about it.
Thank you.
November 22, 2014 at 4:31 am #150381Hi,
I have switched to the theme “twenty fourteen” and this page;
http://jonathan-sainsbury.com.visionphoto.co.uk/collection/tables/adam-anthemion-pier-table/
gives me the breadcrumb;
Home / Collection / Tables / Adam Anthemion Pier Table
Which is how I would like X breadcrumbs to work, in X it is like this;
Home / Collection / Adam Anthemion Pier Table
Mark
November 22, 2014 at 4:33 am #150383This reply has been marked as private.November 23, 2014 at 2:31 am #150815Hi Mark,
Thank you for writing in!
Please add following code in your child theme’s functions.php file:
// Breadcrumbs Display Category Name // ============================================================================= function get_breadcrumb_category( $cat ) { $post = get_post( $post->ID ); $post_type = $post->post_type; $taxonomy = $cat; $f_categories = wp_get_post_terms( $post->ID, $taxonomy ); $f_category = $f_categories[0]; if ( $f_category->parent != 0 ) { $f_category_id = $f_category->parent; $parent_array = get_term_by('id', $f_category_id, $taxonomy, 'ARRAY_A'); $f_category_name = $parent_array["name"]; $term_link = get_term_link( $f_category_id, $taxonomy ); } else { $f_category_id = $f_category->term_id; $f_category_name = $f_category->name; $term_link = get_term_link( $f_category_id, $taxonomy ); } if ( $f_categories && ! is_wp_error($f_categories) ) { return '<a href="' . $term_link . '">' . $f_category_name . '</a>'; } else { return ''; } } 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 ) ); if ( ! is_404() ) { $post_parent = $post->post_parent; } else { $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"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter; if ( is_home() ) { echo $current_before . $blog_title . $current_after; } elseif ( is_category() ) { $the_cat = get_category( get_query_var( 'cat' ), false ); if ( $the_cat->parent != 0 ) echo get_category_parents( $the_cat->parent, TRUE, $delimiter ); 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' ) ) { if ( get_option( 'page_for_posts' ) == is_front_page() ) { echo $current_before . $page_title . $current_after; } else { if ( $is_ltr ) { $f_category = get_the_category(); if ( $f_category[0]->parent != 0 ) { $f_category_id = $f_category[0]->parent; $f_category_name = get_cat_name( $f_category_id ); } else { $f_category_id = $f_category[0]->term_id; $f_category_name = $f_category[0]->name; } echo '<a href="' . get_category_link( $f_category_id ) . '">' . $f_category_name . '</a>' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>'; } } } 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; } } echo '</div>'; } }
Hope this helps. 🙂
Thank you.
November 23, 2014 at 3:33 am #150837Awesome that has worked thanks 🙂
November 23, 2014 at 8:35 pm #151217Cool! You’re so welcome Mark!
December 9, 2014 at 2:41 am #160965I have just noticed a problem with the custom css to make the categories show in the breadcrumbs, it doesn’t show any sub categories.
For instance a product is in the category Mirrors, but in the sub category of Convex (which has mirrors as a parent).
Currently when you enter the sub category the breadcrumb goes to;
Collections/Convex
Can the custom css be changed so that it would read;
Collections/Mirrors/Convex
Edit to add: I original posted this on anther wrong thread and got the response that it required custom development.
December 9, 2014 at 10:30 am #161249Hi Mark,
Thanks for writing in!
This can be possible with custom development but unfortunately, the customization of it will fall beyond the scope of support we can provide. if you require more in depth changes to the breadcrumbs, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities.
Thanks for understanding. Take care!
October 29, 2015 at 5:56 pm #645452I too need the breadcrumbs to work correctly and show the full structure when products are in sub-categories.
Surely it must just be an adjustment to the functions.php code you provided earlier?
Let me know,
-Alex
October 29, 2015 at 6:20 pm #645465I found that by using a great plugin called Perfect SEO URL I managed to get my URL’s looking like this;
http://www.jonathan-sainsbury.com/furniture-collection/mirrors/pier-mirrors/acanthus-convex/
But I still haven’t completely resolved the breadcrumb issues. I guess it get’s confusing when there is multiple categories.
For the above I get this while navigating in;
Furniture Collection > Mirrors
Furniture Collection > Pier Mirrors
Furniture Collection > Mirrors > Acanthus Convex
Ideal would be to get it showing what the URL does.
Mark
October 29, 2015 at 10:20 pm #645698Hello Mark,
Our breadcrumb only displays the parent category. Regretfully the sub categories isn’t a feature offered by the breadcrumb in X. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.
For more assistance, you might want to contact our trusted partners who caters X setup and customization needs. Please see Our Trusted Customization Partners.
This feature is something we can add to our list of feature requests. This way it can be taken into consideration for future development. All of these items are discussed with our team internally and prioritized based on the amount of interest a particular feature might receive.
Thanks for understanding. Take care!
October 30, 2015 at 2:24 am #645954Yes please add this to your feature request list. Of the 3 clients I have done websites for so far they have all asked me about why this isn’t the way it works currently.
Regards,
Mark
October 30, 2015 at 2:34 am #645964Hello Mark,
This was already added. Will let you know once we have an update.
Always,
XDecember 6, 2015 at 6:51 am #694181I’m another client that would like to have that feature! Just to push the priority a bit 😉
-
AuthorPosts