How do i get the parent category name of current woocommerce archive page
-
My WP Woocommerce is using the default page title on the archive-product page of ‘Shop’ – Id like to make a hook which will allow me to dynamically change the title from ‘Shop’ to a custom name on the archive page. So far ive only found a way to change the title ‘Shop’ to a custom name which isn’t much help, thus :
add_filter( 'woocommerce_page_title', 'dynamically_change_woo_shop_page_title'); function dynamically_change_woo_shop_page_title( $page_title ) { $cat = $wp_query->get_queried_object()->term_id; if( $page_title == 'Shop' ) { return "my new shop title"; } }
It must show the top-level parent category name. Today i only have one category of products, but later on when i create other unrelated categories ill want to have a title which reflects the top-level category name; thus creating the effect of a multi-department shop.
Any help appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How do i get the parent category name of current woocommerce archive page’ is closed to new replies.