Skip Navigation

[Resolved] Remove CPT taxonomy title

This support ticket is created 4 years 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Thorworx 4 years ago.

Assisted by: Shane.

Author
Posts
#1560341

Tell us what you are trying to do?
Trying to remove CPT taxonomy title

I've created a CPT called Projects, and a taxonomy for it called Project Categories
When I view a Project Category (Archive page), the title on the page displays as:

Project Category: Industrial

I do not want "Project Category:" to display on the category/archive pages.
I have created a Toolset Archive for this post type to display the view, but there doesn't seem to be a way to edit the title that is displayed (because it is outside the archive loop?).

I don't think that this is a theme issue, because I have a function that removes category titles and descriptions from standard WP archives, and it is working correctly for all other WP post types/taxonomies:

/**
* Remove default words from archive titles like "Category:", "Tag:", "Archives:"
*/
function tworx_remove_default_archive_words($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>' ;
}
return $title;
}
add_filter( 'get_the_archive_title', 'tworx_remove_default_archive_words');

Is there something I can add to my function to remove the Types generated taxonomy titles? Or is there an easier way to control the Archive title output?

#1560601

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for getting in touch.

Did you create a custom archive page for this category ?

If so then it could be that you have the archive title shortcode still on this custom archive.

Please check and let me know.
Thanks,
Shane

#1560641
Screen Shot 2020-03-23 at 4.01.36 PM.png

In Dashboard > Toolset > WordPress Archives
... there are two archives listed for this post type:

Project Categories (taxonomy archive)
Projects (post type archive)

When I edit them, they both look identical (they both display the custom post type in an archive loop).

On both of them, there is no place to change the title of the archive, because it is outside the loop where you can edit the view (see attached).

I have no idea where the "archive title shortcode" is, or how to edit or delete it.

There is no separate custom archive page, I'm just displaying the archive by using the Project Category menu item in Appearance > Menus.

#1560819

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Ok thank you, now that we've confirmed that it isn't coming from there.

Can you try adding this to your conditionals as well "is_tax()".

So you will need to check for the specific taxonomy that was created in Types. So an example would look like

} elseif ( is_tax('taxonomy-slug') ) {
$title = single_cat_title( '', false ) ;
}

If this doesn't work please try the plugin below and let me know if it helps.
https://wordpress.org/plugins/archive-title/

Thanks,
Shane

#1561541

Shane,
That did the trick. Thanks for your help.

It would be nice if we didn't have to edit the functions.php file to do this. Perhaps the devs could look into allowing us to set CPT category titles for display purposes at some point in the future.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.