Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #14281


    In a previous post regarding the breadcrumb logic, (http://www.kriesi.at/support/topic/breadcrumbs-glitching-illogical-structure) … i.e. home/shop/product/product title, it was suggested to use the following in class-breadcrumbs.php to have it look like home/shop/category/product title.

    code suggested:

    /* If there’s an archive page, add it to the trail. */

    if ( !empty( $post_type_object->has_archive ) && function_exists( ‘get_post_type_archive_link’ ) ){

    if (is_product()){

    $prod_cat = array();

    $prod_cat[] = get_the_term_list(get_the_ID(), ‘product_cat’);

    $trail[] = $prod_cat[0];


    $trail[] = ‘labels->name ) . ‘”>’ . $post_type_object->labels->name . ‘‘;



    It took out the redundancy, but now on the single-product details page, I’m missing the ‘shop’ link. It looks like this: home/category/product title. Not a huge issue, but ideally, it would be great to add the ‘shop’ back in.

    Thanks -



    I just pasted the code above into my local demo and on page for a product called Big Gold Ring in category Jewelry inside a Shop that lists all products from all categories i see the breadcrumbs:

    You are here: Home » Shop » Jewelry » Big Gold Ring

    or are you asking for Jewelry to come before the Shop?




    No, I’d like it to be:

    Home » Shop » Category » Product Title

    It is just showing:

    Home » Category » Product Title on the single product page.

    I must have something checked in the settings, but not sure what.



    And you already have the code you mentioned earlier in place substituting a small block of code around line 255 of class-breadcrumb.php ? (code below).

    /* If there's an archive page, add it to the trail. */
    if (!empty($post_type_object->has_archive) && function_exists('get_post_type_archive_link')) {
    if (is_product()) {
    $prod_cat = array();
    $prod_cat[] = get_the_term_list(get_the_ID(), 'product_cat');
    $trail[] = $prod_cat[0];
    } else {
    $trail[] = '<a href="' . get_post_type_archive_link($post_type) . '" title="' . esc_attr($post_type_object->labels->name) . '">' . $post_type_object->labels->name . '</a>';

    Please also check under WooCommerce > Settings > Pages and please go over the settings to see that they are the way you want, and if there is a Shop page created.




    Well, feeling a little silly now, but I checked the class-breadcrumb.php file from my original download folder and compared the two. Seems like the following was missing and now it works beautifully! (inadvertently erased I’m supposing).

    /* If there’s a slug, add it to the $path. */

    if ( !empty( $post_type_object->rewrite ) )

    $path .= $post_type_object->rewrite;

    /* If there’s a path, check for parents. */

    if ( !empty( $path ) )

    $trail = array_merge( $trail, avia_breadcrumbs_get_parents( ”, $path ) );



    Great! It’s little things like that which usually cause the most stress.

    Good luck and thanks for posting what the problem was,



    Thanks for your help.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Breadcrumb missing 'shop' link’ is closed to new replies.