Site logo

[Resolved] Custom taxonomy archive title is missing

Home Forums Support [Resolved] Custom taxonomy archive title is missing

Home Forums Support Custom taxonomy archive title is missing

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2453848
    George

    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?

    #2453859
    George

    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?

    #2453997
    Fernando
    Customer Support

    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.

    Reference: https://github.com/tomusborne/generatepress/blob/4895a2e7595bb809075b375201fd735112f41570/no-results.php

    You can also use a Hook Element and add a code like this for instance:

    <?php
    echo '<h1>'. get_the_archive_title() . '</h1>';
    
    ?>
    #2454410
    George

    Awesome, thanks Fernando!

    #2455245
    Fernando
    Customer Support

    You’re welcome, George!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.