Skip to content

Instantly share code, notes, and snippets.

@ashsaraga
Last active August 27, 2021 16:26
Show Gist options
  • Save ashsaraga/007a7560172c6104da52a9b240aa8e0e to your computer and use it in GitHub Desktop.
Save ashsaraga/007a7560172c6104da52a9b240aa8e0e to your computer and use it in GitHub Desktop.
<?php
echo post_type_archive_title( '', false );
<?php
add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
$title = single_cat_title( '', false ); // set $title to 'Category Title', but do not display
} elseif ( is_tag() ) {
$title = single_tag_title( '', false ); // set $title to 'Tag Title', but do not display
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ; // set $title to 'Author'
}
return $title;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment