Skip Navigation

[Resolved] Taxinomie & slug Title

This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 3 years, 6 months ago.

Assigned support staff: Minesh.

Author
Posts
#1210399

Tell us what you are trying to do?

For taxonomy cateorie, the name of the taxonomy is automatically displayed on the front-end, how to have only the category? I tried to remove "Parent% s:" but it still shows up

Concrete example: hidden link
The title = Hôtels à Destination Hotels: Nosy Be - Madagascar
IN DETAIL from elementor template :
Hotel in = add via elementor before the title
Destination: Nosy Be = The title (the title is just "Nosy Be" which is part of the taxonomy "destination")
- Madagascar = added via elementor after the title

So, how remove the "destination :" ?
"destination" = taxinomie slug from the title

#1210474

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - as I understand do you want to remove the category/taxonomy name that is "Hôtels à Destination" from the taxonomy title?

Hôtels à Destination : Nosy Be - Madagasca
#1211021

Hi,

Thanks for your answer
yes i want to remove : Destination, so category/taxonomy name

Regards

#1211030

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - Views offers the shortcode [wpv-archive-title], "Archive" word:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-archive-title

If you want to remove the taxonomy name from your archive title, you need to use the following code within your functions.php file:

function func_override_archive_title( $title ) {
    if ( is_category() ) {
        $title = single_cat_title( '', false );
    } elseif ( is_tag() ) {
        $title = single_tag_title( '', false );
    } elseif ( is_author() ) {
        $title = '<span class="vcard">' . get_the_author() . '</span>';
    } elseif ( is_post_type_archive() ) {
        $title = post_type_archive_title( '', false );
    } elseif ( is_tax() ) {
        $title = single_term_title( '', false );
    }
   
    return $title;
}
 add_filter( 'get_the_archive_title', 'func_override_archive_title' );

More info:
=> https://developer.wordpress.org/reference/functions/get_the_archive_title/

You can add the above function to Toolset's custom code section as well if you do not want to add it to functions.php file:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/