Home Forums Basel support forum Breadcrumbs custom behavior

Breadcrumbs custom behavior

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3981

    vinzbomb
    Participant

    Hi,
    here i go with my noob question:

    Is there a way to change the behavior of the main category in the breadcrumbs links ?
    I mean, i use as main category a page, not a real product category in woocommerce for all my products. So when i click on the first main category link in breadcrumbs it goes back to an empty category not my page. (that’s how it works and normal)
    Is it possible to customize that ?
    For example i have the main category “Guitars” (a page) and sub categories –Electric Guitars etc… but i need the first breadcrumb link to go back to my page “Guitars”, not the woocommerce category.
    I hope i was clear enough lol!
    thanks for helping to find a way !!!

    #3993

    Artem Temos
    Keymaster

    Hello,

    Thank you for contacting us.

    We would be glad to help you but we don’t have any quick instruction or tutorial that may help with your question. Due to a fact that it requires additional customization, it is out of our support scope according to Envato support policy.

    Regards

    #3997

    vinzbomb
    Participant

    Ok i understand it, you mean its because, its a wordpress feature ?
    i will try to find a way
    thanks for the reply !

    #3999

    Artem Temos
    Keymaster

    But there is one thing that you can try. The following code should swap the link for your category to be the actual page link. Place it into your child theme functions.php and replace category slug with your own

    function basel_breadcrumb_cat_link($value, $term) {
        $link = $value;
        if($term->slug == 'guitars') {
            $link = get_bloginfo('url').'/guitars/';
        }
        return $link;
    }
    add_filter( 'term_link', 'basel_breadcrumb_cat_link', 2, 2 );
    
    #4006

    vinzbomb
    Participant

    ok thanks i will try that !
    i really appreciate

    #4023

    Artem Temos
    Keymaster

    We are happy to help you!

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