-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breadcrumbs drops 'Shop' on move to category pages. #1993
Comments
+1 on this, it should show the Shop page in between. Maybe not for all setups though, maybe it should respect the URL structure? I hate this becoming another option, but that might be the only possibility to suit all needs. @mikejolley What do you think? |
+1 on this, although i personally think the breadcrumb structure needs to be overhauled as voiced in previous tickets :) love your guys work though :) making this even more immmense! |
In 2.0, if in permalink settings you give the categories a base containing shop/ it will be added to the breadcrumb. As @coenjacobs said. Guess he didn't realise I coded it :) |
Hi, I have removed the link to the shop from breadcrumb. The shop link: http://mylink.com/termekek How can I display a link between the shop and the main categories? Thanks for your help! |
+1 on this too! |
I believe @mikejolley answered above. Yet I'm still unclear as I have tried setting product category and tag bases to shop/ and the breadcrumbs do not reflect any change. |
Hi, I was debugging the original issue and unfortunatelly Woocommerce doesn't use any hooks to directly adjust the breadcrumbs array. So if you want to modify the breadcrumbs shown without changing your permalinks structure, best is to copy the breadcrumbs template file from plugin ( /woocommerce/templates/global/breadcrumb.php) into your theme (/theme_name/woocommerce/global/) and there add the code to inlude the link before the output loop starts. I only do it for product category, tag and detail but you can add other conditionals if you like. <?php
/**
* Shop breadcrumb
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.3.0
* @see woocommerce_breadcrumb()
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( $breadcrumb ) {
// add shop home url to breadcrumbs
if( is_product_category() || is_product_tag() || is_product() ) {
$shop_page_id = wc_get_page_id( 'shop' );
$shop_home_arr = array( get_the_title($shop_page_id), get_permalink($shop_page_id));
// insert to breadcrumbs array on second position
array_splice($breadcrumb, 1, 0, array($shop_home_arr));
}
echo $wrap_before;
foreach ( $breadcrumb as $key => $crumb ) {
echo $before;
if ( ! empty( $crumb[1] ) && sizeof( $breadcrumb ) !== $key + 1 ) {
echo '<a href="' . esc_url( $crumb[1] ) . '">' . esc_html( $crumb[0] ) . '</a>';
} else {
echo esc_html( $crumb[0] );
}
echo $after;
if ( sizeof( $breadcrumb ) !== $key + 1 ) {
echo $delimiter;
}
}
echo $wrap_after;
} |
I don't understand why this was closed. Adding the shop page slug to the "Product category base" in Permalinks has no effect on the breadcrumbs. Update: I think I see now. I have set the single Product Permalinks to include the shop page slug, and also given the categories a base including the shop page slug. It got 404 errors on category pages when the product permalinks included the category, though. I ended up with these settings:
|
WooCommerce ver. 1.6.6
WordPress vers. 3.4.X and 3.5
On the 'Shop' page woocommerce_breadcrumb() displays:
'Home > Shop'
Moving past the top level shop page woocommerce_breadcrumb() drops the 'Shop' and displays:
'Home > CATEGORY_NAME' for example 'Home > Polymer Ribs'
There is no link to the 'Shop' page.
Should display 'Home > Shop > CATEGORY_NAME'
The text was updated successfully, but these errors were encountered: