Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tacoverdo/ed594adc1f91776eec49682ba2ad89a3 to your computer and use it in GitHub Desktop.
Save tacoverdo/ed594adc1f91776eec49682ba2ad89a3 to your computer and use it in GitHub Desktop.
There are two sets of code in this gist. One for non-WooThemes and one for WooThemes. Only copy the section you need to replace breadcrumbs
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Replace WooCommerce Breadcrumbs With Yoast Breadcrumbs
* Credit: Unknown
* Last Tested: Jan 25, 2018 using Yoast SEO 6.2 on WordPress 4.9.2
* Theme: Non-WooThemes like Twenty Seventeen, Genesis
*/
// Remove WooCommerce Breadcrumbs
remove_action( 'init', 'woocommerce_breadcrumb', 20 );
remove_action( 'woocommerce_before_main_content','woocommerce_breadcrumb', 20 );
//Add Yoast Breadcrumbs
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>');
}
}
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Replace WooCommerce Breadcrumbs With Yoast Breadcrumbs
* Credit: Unknown
* Last Tested: Oct 15, 2016
* Theme: WooThemes like Storefront
*/
// Remove WooCommerce Breadcrumbs
add_action( 'init', 'jk_remove_storefront_breadcrumb' );
function jk_remove_storefront_breadcrumb() {
remove_action( 'storefront_content_top', 'woocommerce_breadcrumb', 10 );
}
//Add Yoast Breadcrumbs
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>');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment