Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1464052

    Hello. When on the single product pages, is there a way to make the breadcrumb only show up to the last category, and not display the individual (single) product page titles? Thanks.

    #1464096

    Hey Illingco,

    Thank you for the inquiry.

    Please try to add this filter in the functions.php file:

    function avia_breadcrumbs_trail_mod($trail) {
        if (is_singular('product')) {
            unset($trail['trail_end']);
        }
    
        return $trail;
    }
    add_filter('avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 50, 1);
    

    Best regards,
    Ismael

    #1464164

    Thank you for this! Is there any way to remove the category or product title of the page the user is on? Otherwise this will do. Also, what might the CSS be to change color as a user hovers on each part of the breadcrumb? Thanks for all the support!

    #1464199

    Hi,

    Thank you for the update.

    If you want to remove the category trail, just add this code:

    unset($trail[3]);
    

    .. under this line:

    unset($trail['trail_end']);
    

    And to change the color of the breadcrumb trail on hover, add this css code:

    .breadcrumb-trail :hover {
        color: blue !important;
    }
    

    Best regards,
    Ismael

    #1464267

    Thanks for this. But I meant do not show the category that the user is on no matter what page they are on, be it category page or single product page. Like if I am on the page for Plastic Round Open Head Pails as linked, the breadcrumb would be Home / Shop / Pails & Buckets without Plastic Round Open Head Buckets as the last part of the string, since the user is already on that page. But I would like the full string on single product pages but without the product title on those pages. If both are not possible please let me know. Thanks.

    #1464337

    Hi,
    When I test this does what you ask on my test site:

    function avia_breadcrumbs_trail_mod($trail) {
        if (is_singular('product') || is_archive()) {
            unset($trail['trail_end']);
    		unset($trail[3]);
    		unset($trail[2]);
        }
    
        return $trail;
    }
    add_filter('avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 50, 1);

    Best regards,
    Mike

    #1464461

    Hi Mike. I don’t see that it does work. That code takes it down to Home / Shop, and that is it. I’m just looking to ideally truncate the category page if a user is on it, but have it back on single product pages, but not the title of that page. However, this seems to work as asked for:

    function avia_breadcrumbs_trail_mod($trail) {
    if (is_singular(‘product’) || is_archive()) {
    unset($trail[‘trail_end’]);
    }

    return $trail;
    }
    add_filter(‘avia_breadcrumbs_trail’, ‘avia_breadcrumbs_trail_mod’, 50, 1);

    • This reply was modified 3 months, 1 week ago by Illingco.
    #1464501

    Hi,

    Is there any way to remove the category or product title of the page the user is on?

    Previously, you asked if it was possible to remove or hide the category. The snippet we suggested earlier should remove both the category and the post title.

    Best regards,
    Ismael

    #1464536

    I found the correct combination of code, thank you. You may close this ticket.

    #1464565

    Hi,

    Thanks for the update, we’ll close this thread for now then. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Breadcrumb not to display single product titles?’ is closed to new replies.