Support » Theme: Twenty Twenty-One » remove category titles

  • Resolved minimizeandtravel

    (@minimizeandtravel)


    Hi how can I remove this category title? So the word category and the category title? It takes up most of the screen. Thank you in advance.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • If you want to remove the word “Category” or “Tag” from the title, it depends on what version of WordPress you are running.

    For v5.5 or newer add this to your functions.php …

    add_filter('get_the_archive_title_prefix', 'twenty_one_get_the_archive_title_prefix');
    function twenty_one_get_the_archive_title_prefix($prefix) {
      if ($prefix === 'Category:' || $prefix === 'Tag:') {
        $prefix = '';
      }
      return $prefix;
    }

    … or for older versions of WordPress …

    add_filter('gettext', 'twenty_one_replace_archive_titles', 10, 3);
    function twenty_one_replace_archive_titles($translation, $text, $domain) {
      if ($text === 'Category: %s' || $text === 'Tag: %s') {
        $translation = '%s';
      }
      return $translation;
    }

    Let me know if that works and I’ll add it to the Options for Twenty Twenty-One plugin.

    Oliver

    Otherwise, if you want to remove the entire title, you can do this with CSS added to “Customizer – Additional CSS” …

    .archive .page-header {
    display: none;
    }

    Oliver

    minimizeandtravel

    (@minimizeandtravel)

    Hi Oliver

    Thank you so much the CSS worked

    Glad it worked. It’s now an option in the plugin Options for Twenty Twenty-One.

    Oliver

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