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

    Hello!
    When the post has more that one category selected, there is a combobox below to choose “main category”, which does nothing but helping to use right breadcrumbs. But in my case choosing another main category does not change breadcrumbs. Is it possible to select category to get breadcrumb I need?

    #1473466

    Hey ibuzaev,

    Thank you for the inquiry.

    Where can we check the issue? Please provide the site URL in the private field and post a screenshot using platforms like Savvyify, Imgur or Dropbox.

    Best regards,
    Ismael

    #1473591
    #1473725

    Hi,

    Thank you for the update.

    The sidebar and widgets are missing on the page you posted above. Also, the breadcrumb is not updating because there is no script present that connects the category selection with the breadcrumb, meaning they won’t interact with each other. Unfortunately, connecting these two would require modifications that are beyond the scope of support.

    Best regards,
    Ismael

    #1473791

    Dear Ismael,
    I did not understand about sidebar and widgets, did I something wrong with that script? Does sidebar and widgets presence solve that problem?

    #1473792

    The sidebar I send in the screenshot is standard sidebar of wordpress edit. If there is more than one category selected additional combobox appears to select “main category” which usually is used I suppose to permalink category and breadcrumbs.

    #1473807

    Hi,

    Sorry for the misunderstanding. I thought there was a sidebar widget that allows you to filter categories. If you need to include the parent category in the breadcrumb trail, please try adding this filter to the functions.php file:

    function avia_breadcrumbs_trail_mod($trail) {
        if (get_post_type() === 'post' && is_single()) {
            $categories = get_the_category();
            if (!empty($categories)) {
                usort($categories, function($a, $b) {
                    return $a->parent - $b->parent;
                });
    
                $parent_category = $categories[0];
                $category_link = '<a href="' . get_category_link($parent_category->term_id) . '" title="' . esc_attr($parent_category->name) . '">' . esc_html($parent_category->name) . '</a>';
    
                $newtrail = array();
                $newtrail[0] = $trail[0]; 
                $newtrail[1] = $trail[1]; 
                $newtrail[2] = $category_link; // Parent category link
                $newtrail[3] = $trail[2]; // Child category link
                $newtrail['trail_end'] = $trail['trail_end'];
    
                $trail = $newtrail;
            }
        } 
    
        return $trail;
    }
    
    add_filter('avia_breadcrumbs_trail','avia_breadcrumbs_trail_mod');

    Best regards,
    Ismael

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.