Created
December 16, 2015 22:35
-
-
Save mrwweb/267e67de060017f52487 to your computer and use it in GitHub Desktop.
Simple category and other archive page titles in WordPress 4.1+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'get_the_archive_title', '{prefix}_cat_title' ); | |
/** | |
* Remove "Category: " prefix from Category archive pages | |
*/ | |
function {prefix}_cat_title( $title ) { | |
if( is_category() ) { | |
$title = single_cat_title( '', false ); | |
} | |
return $title; | |
} | |
add_filter( 'get_the_archive_title', '{prefix}_term_title' ); | |
/** | |
* Remove "Category: ", "Tag: ", and "{Taxonomy}: " prefixes from all term archive pages | |
*/ | |
function {prefix}_term_title( $title ) { | |
if( is_category() || is_tag() || is_tax() ) { | |
$title = single_term_title( '', false ); | |
} | |
return $title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment