• fesarlis

    (@fesarlis)


    I am using a product filter which I am assuming uses something like pre_get_posts to filter products (Filter Everything).

    As a result, there is a URL of the form?https://mysite.com/category-pencils?(Filter Everything created). Instead of https://mysite.com/category/pencils (Woo default).

    This has also the side-effect that the actual page is not actually a taxonomy archive anymore. Therefore, Breadcrumb NavXT cannot retrieve the category.

    Is there any idea if I can do something with this? I am not an expert in coding. Perhaps adding to the trail by page title (which is now Category | Sitename)?

    Thank you

Viewing 1 replies (of 1 total)
  • Thread Starter fesarlis

    (@fesarlis)

    I was able to do something utilizing John’s example (https://mtekk.us/archives/guides/add-a-static-breadcrumb-to-the-breadcrumb-trail/). Here is my code:

    add_action('bcn_after_fill', 'my_static_breadcrumb_adder');

    function my_static_breadcrumb_adder($breadcrumb_trail) {

    $output = flrt_selected_filter_terms();

    $w1 = array_keys($output)[0];
    $x1 = $output[$w1]["values"][0];
    $y1 = get_term_by('slug', $x1, 'product_cat');
    $z1 = $y1->name;

    if (isset($z1)) {
    $new_breadcrumb1 = new bcn_breadcrumb($z1, NULL, array('home'), get_site_url() . '/e-shop/' . $w1 . '-' . $x1, NULL, true);
    array_splice($breadcrumb_trail->breadcrumbs, -4, 0, array($new_breadcrumb1));
    }
    }

    My only problem is that I cannot add the extra trail part to schema.org data (itemListElement->name). Still shows ‘E-SHOP’. It should be the category name.

    • This reply was modified 2 months ago by fesarlis.
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.