0

As we only have one category for all posts, it doesn't make sense to have the category link in our breadcrumbs. So instead of:

frontpage/category_name/post_name

We would like:

frontpage/post_archive (home)/post_name

Can't find any article on how to do this properly. Can anyone help?

Thanks!

Virik
  • 397
  • 1
  • 4
  • 18

2 Answers2

0

I ended up using Yoast SEO breadcrumbs, as we're using this plugin anyways. To swap WooCommerce breadcrumbs for Yoast, use the following code:

// Replace WooCommerce breadcrumbs with Yoast bredcrumbs
remove_action('init', 'woocommerce_breadcrumb', 20, 0);
remove_action('woocommerce_before_main_content','woocommerce_breadcrumb', 20, 0);
add_action( 'woocommerce_before_main_content','my_yoast_breadcrumb', 20, 0);
if (!function_exists('my_yoast_breadcrumb') ) {
  function my_yoast_breadcrumb() {
    yoast_breadcrumb('<p id="breadcrumbs">','</p>');
  }
}
Virik
  • 397
  • 1
  • 4
  • 18
  • You can actually easily filter Yoast's breadcrumb path. I added a link to another such code example above. – Jan Boddez Sep 18 '17 at 17:25
  • Thanks, but they have their own fields for overriding this in the default settings. Yoast works quite good :) – Virik Sep 18 '17 at 21:17
-1

Please use below plugin. its good plugin.

https://wordpress.org/plugins/breadcrumb-navxt/

  • Hmm.. Was looking for a simple snippet for functions.php. Would prefer not to add many plugins to our page. I'd rather use Yoast breadcrumbs. – Virik Sep 18 '17 at 12:49
  • You can modify Yoast's breadcrumb path by adding a filter to `wpseo_breadcrumb_links`. Kind of this: https://wordpress.stackexchange.com/questions/100012/how-to-add-a-page-to-the-yoast-breadcrumbs. – Jan Boddez Sep 18 '17 at 17:24