简体   繁体   中英

Woocommerce display taxonomy title in current taxonomy archive page

So, I have in the menu a link to a taxonomy archive that shows every product associated with that taxonomy. Wordpress shows the correct page-title in category/tag archive, instead it shows the latest product title in the taxonomy page, that is nonsense.

I know that there's something about archive.php

elseif ( is_category() )

    $title = sprintf( __( 'Category Archives: %s', 'mirage' ), '<span>' . single_cat_title( '', false ) . '</span>' );

elseif ( is_tag() )

    $title = sprintf( __( 'Tag Archives: %s', 'mirage' ), '<span>' . single_tag_title( '', false ) . '</span>' );

elseif ( is_day() )

    $title = sprintf( __( 'Daily Archives: %s', 'mirage' ), '<span>' . get_the_date() . '</span>' );

I tried to add an is_tax() etc. but nothing seems to reflect on the frontend.

I need to get the current taxonomy name and put it in the same page title.

Hope I made it clear. Thanks.

You can use:

elseif ( is_product_taxonomy() )
    single_term_title();
endif;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM