Answer the question
In order to leave comments, you need to log in
How to remove breadcrumb element in Wordpress+Woocommerce+Astra?
In the online store on the WP+Woocommerce+Astra theme, on the product page, breadcrumbs are generated indicating the path from the main page to the current category or product page.
How to cut a link to the main page from this path and make the crumbs start from the product catalog page (from the second paragraph)?
Answer the question
In order to leave comments, you need to log in
The template responsible for the HK array is located in the plugin folder: "\wp-content\plugins\woocommerce\templates\global\breadcrumb.php"
acc. with documentation, you can copy it to your theme folder:
\OurTheme\woocommerce\global\breadcrumb.php
And then, edit as you like, it's pretty simple. In the example below, we "cut" the link to product-category
if ( ! empty( $breadcrumb ) ) {
echo $wrap_before;
foreach ( $breadcrumb as $key => $crumb ) {
echo $before;
if ( ! empty( $crumb[1] ) && sizeof( $breadcrumb ) !== $key + 1 ) {
echo '<a href="' . esc_url( str_replace('product-category/','', $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;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question