Created
March 4, 2019 13:20
-
-
Save eirichmond/21bab5465c85db48ab302e29dcb55d52 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/* a couple of filters to remove elements from titles */ | |
add_filter( 'get_the_archive_title', 'wptv_remove_title_elements', 10, 1); | |
function wptv_remove_title_elements($title) { | |
if ( is_category() ) { | |
$title = single_cat_title( '', false ); | |
} | |
return $title; | |
} | |
/* if you want to remove elements from other archive pages use the other wp conditionals */ | |
add_filter( 'get_the_archive_title', 'wptv_remove_title_elements_example_two', 10, 1); | |
function wptv_remove_title_elements_example_two($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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment