Archived topic
Custom taxonomy archive title is missing
4 replies · Started by George on December 7, 2022
I am not sure why but it seems there is no title when I view a custom post type's custom taxonomy archive. Both the custom post type and the taxonomy have been created with the CPT UI plugin and all the right settings seem to be in place.
Do I need some kind of filter for this?
Ok, it seems that title is not being displayed if there are no posts under it. Is there a solution apart from making it a static page archive?
Hi George,
Yes, this is the default before if there are no posts in an archive page - it uses the no-results.php template.
For one, if you're using the Child theme, you can make a copy of no-results.php, then make a conditional statement to implement "get_the_archive_title()" when necessary.
You can also use a Hook Element and add a code like this for instance:
<?php
echo '<h1>'. get_the_archive_title() . '</h1>';
?>
Awesome, thanks Fernando!
You're welcome, George!