I have read all through this forum, and done other internet searches. I have tried at least a dozen variations of suggested code, but I cannot get the title of a post category archive page to change.
The post category is “Latest”. When I add /latest/ to the end of our site URL, that is what is shown on the archive page. I want to change that title to “NCGS Announcements Archive”.
For example:
add_filter( ‘get_the_archive_title’,’ncgs_latest_archive_title’, 10, 1 );
function ncgs_latest_archive_title($title){
if (is_category(‘latest’) ) $title = ‘NCGS Announcements Archive’;
return $title;
}
Also tried:
add_filter( ‘get_the_archive_title’, function ($title) {
if ( is_category(‘latest’) ) {
$title = ‘NCGS Announcements Archive’;
return $title;
}});
And:
function change_latest_title( $title ){
if ( $title == ‘Latest’ ) $title = ‘NCGS Announcements Archive’;
return $title;
}
add_filter( ‘get_the_archive_title’, ‘change_latest_title’ );
And many variations similar to these.
I have the Code Snippets plugin installed, and it works very well for for making changes like this. So I am not trying to overwrite actual GP code. I’m using GeneratePress 2.3.2 and GP Premium 1.8.3
After spending most of a day trying things that don’t work, I’m just stumped. I’m hoping you can help me out here.
Thanks in advance for any assistance.