Home Forums HashOne Title of the category

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4645
    shap
    Participant

    Sorry for my English 😉
    I have a problem.
    How do I delete the “Category:” text displayed in the title in the page header (in the category posts)? Now “Category: News” is displayed, I would like to display the same “News”.

    #4670
    shap
    Participant

    How to remove “Category:” from category title
    It’s easy to do that. Simply open the functions.php file in your theme and add the following code at the end of the file:

    function prefix_category_title( $title ) {
    if ( is_category() ) {
    $title = single_cat_title( ”, false );
    }
    return $title;
    }
    add_filter( ‘get_the_archive_title’, ‘prefix_category_title’ );

    Now refresh your category pages and you will see “Category: ” is gone.

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