Reputation: 61
I would like to remove the ‘Category’ from header title text on category pages in wordpress. Have tried several plugins that claim to remove these but don’t seem to work with my version.. (4.9.6)
Here a screenshot of how it looks now: https://i.sstatic.net/nF7qy.jpg
So would want to have only ‘News’ displayed there. Anyone knows a way of getting rid of the Category before it?
All the best and thanks in advance!
Upvotes: 3
Views: 7474
Reputation: 384
Just add a line into your functions.php (After WP5.5).
add_filter( 'get_the_archive_title_prefix', '__return_false' );
Upvotes: 3
Reputation: 637
In Magazine Base theme:
The title is added from the file inc/hooks/header-inner-page.php
using the function the_archive_title()
like
the_archive_title('<h1 class="entry-title">', '</h1>');
to remove Category
from the output you need to add the following filter in your functions.php
add_filter( 'get_the_archive_title', function ($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;
});
Code credit: Here
That would fix the issue.
Upvotes: 3
Reputation: 2157
check in archive.php or category.php
it is loading from here
<h1 class="entry-title">Category: News</h1>
you can check and edit any of the above mentioned files.
Upvotes: -1