How to change texonomy page or archive page title in wordpress
For change archive page title or customize archive page title just paste below code into your theme's functions.php file and change as per your need.
add_filter( 'get_the_archive_title', 'rj_customize_archive_page_title',10,1 );
function rj_customize_archive_page_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>' ;
}elseif ( is_tax('video-categories') || is_tax('video_tag') ) {
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$title = $term->name;
}
return $title;
}
add_filter( 'get_the_archive_title', 'rj_customize_archive_page_title',10,1 );
function rj_customize_archive_page_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>' ;
}elseif ( is_tax('video-categories') || is_tax('video_tag') ) {
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$title = $term->name;
}
return $title;
}
Comments
Post a Comment