Last active
August 3, 2023 09:14
-
-
Save Nikschavan/f625ae2afa770b04c940de932a8becbc to your computer and use it in GitHub Desktop.
Revisions
-
Nikschavan revised this gist
Feb 10, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ * @return Array WooCommerce Breadcrumb crumbs with default category removed. */ function your_prefix_wc_remove_uncategorized_from_breadcrumb( $crumbs ) { $category = get_option( 'default_product_cat' ); $caregory_link = get_category_link( $category ); foreach ( $crumbs as $key => $crumb ) { -
Nikschavan revised this gist
Feb 10, 2018 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,12 @@ <?php // don't copy this line in your code. /** * Remove uncategorized from the WooCommerce breadcrumb. * * @param Array $crumbs Breadcrumb crumbs for WooCommerce breadcrumb. * @return Array WooCommerce Breadcrumb crumbs with default category removed. */ function your_prefix_wc_remove_uncategorized_from_breadcrumb( $crumbs ) { $category = get_option( 'default_product_cat' ); $caregory_link = get_category_link( $category ); foreach ( $crumbs as $key => $crumb ) { @@ -16,7 +15,7 @@ function your_prefix_wc_remove_uncategorized_from_breadcrumb( $crumbs ) { } } return array_values( $crumbs ); } add_filter( 'woocommerce_get_breadcrumb', 'your_prefix_wc_remove_uncategorized_from_breadcrumb' ); -
Nikschavan revised this gist
Feb 10, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ <?php // don't copy this line in your code. /** * Remove uncategorized from the WooCommerce breadcrumb. -
Nikschavan revised this gist
Feb 10, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ * @return Array WooCommerce Breadcrumb crumbs with default category removed. */ function your_prefix_wc_remove_uncategorized_from_breadcrumb( $crumbs ) { $category = get_option( 'default_product_cat' ); $caregory_link = get_category_link( $category ); foreach ( $crumbs as $key => $crumb ) { -
Nikschavan created this gist
Feb 10, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ <?php // don't copy this file in your code. /** * Remove uncategorized from the WooCommerce breadcrumb. * * @param Array $crumbs Breadcrumb crumbs for WooCommerce breadcrumb. * @return Array WooCommerce Breadcrumb crumbs with default category removed. */ function your_prefix_wc_remove_uncategorized_from_breadcrumb( $crumbs ) { $category = get_option( 'default_product_cat' ); $caregory_link = get_category_link( $category ); foreach ( $crumbs as $key => $crumb ) { if ( in_array( $caregory_link, $crumb ) ) { unset( $crumbs[ $key ] ); } } return $crumbs; } add_filter( 'woocommerce_get_breadcrumb', 'your_prefix_wc_remove_uncategorized_from_breadcrumb' );