Skip to content

Instantly share code, notes, and snippets.

@proweb
Last active May 7, 2017 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save proweb/f329cde740e0802870871bef830fab50 to your computer and use it in GitHub Desktop.
Save proweb/f329cde740e0802870871bef830fab50 to your computer and use it in GitHub Desktop.
Wordpress. Function for remove archive prefix from archive title. Remove “Category:”, “Tag:”, “Author:” from the_archive_title.
function remove_category_prefix_from_archive_title( $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;
}
add_filter( 'get_the_archive_title', 'remove_category_prefix_from_archive_title' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment