Is there a way to display the product category name on the WooCommerce archive-product.php
page.
My product category name is “Bracelets”, and I’d like that to be displayed as a title on the page.
I’m using wp_title()
currently:
<h1><?php wp_title(); ?></h1>
But that prints it to the page like this:
» Product Categories » Bracelets
I’m getting the parent page title and the catgeory name with separators in between them (above).
Is there any way I can get the title to print just “Bracelets”?
Any help with this is appreciated.
Thanks in advance!
You’re looking for
single_term_title()
:https://developer.wordpress.org/reference/functions/single_term_title/
Currently you can display product categories this way (WordPress 4.x):
Use the get_categories function to retrieve categories name :-
You can use this code to display product categories name –
I think it prints the breadcrumb, because it’s hooked woocommerce_breadcrumb.
You could override in your theme the template Archive-product.php
and create another action inside functions.php,
Inside your functions.php you can also create a functions like this: