Adding Breadcrumbs to a child theme's WooCommerce page

Hello, I’d like to add breadcrumbs to the following page:
http://a1props.frogadio.com/product-category/rental/patient-monitoring/

We have it on the product page:
http://a1props.frogadio.com/product/solar-eclipse-8000i/

I can’t figure out which page to add/copy to the child theme, because of this whole “stack” setup, so that I can insert the function into the functions page and then the hook into the page.

We’re running “Pro” with the Icon stack.

Thanks!

Hi There,

Please add the following code under functions.php file locates in your child theme:

add_action( 'woocommerce_before_shop_loop', 'print_product_cat_breadcrumb' );
function print_product_cat_breadcrumb(){
	if(x_is_product_category()){
		echo do_shortcode( '[your-breadcrumb-shortcode]' );
	}
}
1 Like

I added the code to the child’s function and didn’t see any updates.

http://a1props.frogadio.com/product-category/rental/patient-monitoring/

** UPDATE ** I added it to the main function.php file just to see if it rendered. It did. But only with the “[your-breadcrumb-shortcode]” output, not the actual breadcrumbs.

** UPDATE 2 ** code is in correct child theme now.
HOWEVER, I’m still getting the output as mentioned above. Is there a plugin that I need to activate for this shortcode? Thanks! :slight_smile:

Hi there,

X does not have a Breadcrumb shortcode by default and you will need to use 3rd party plugins to have such a functionality. This article can be a good start to get used to the plugins you possibly can use.

Thank you.

If you’re running Yoast the advance version, then you can swap out that dead shortcode in the function above with this one: [wpseo_breadcrumb]

You can put it in a div and stylize it with CSS.

add_action( ‘woocommerce_before_shop_loop’, ‘print_product_cat_breadcrumb’ );
function print_product_cat_breadcrumb(){
if(x_is_product_category()){
echo do_shortcode( ‘

[wpseo_breadcrumb]
’ );
}
}

Hi there,

Yes, any breadcumbs with shortcodes should work.

And thanks for sharing :wink: