Wednesday, October 31, 2018

How to remove archive title in WordPress

function ganesh_archive_title($title){

if ( is_category() ) {

$title = sprintf( esc_html__( '%s', 'himalayasunrise' ), single_cat_title( '', false ) );

} elseif ( is_tag() ) {

$title = sprintf( esc_html__( '%s', 'himalayasunrise' ), single_tag_title( '', false ) );

} elseif ( is_author() ) {

$title = sprintf( esc_html__( '%s', 'himalayasunrise' ), '<span class="vcard">' . get_the_author() . '</span>' );

} elseif ( is_year() ) {

$title = sprintf( esc_html__( '%s', 'himalayasunrise' ), get_the_date( esc_html_x( 'Y', 'yearly archives date format', 'himalayasunrise' ) ) );

} elseif ( is_month() ) {

$title = sprintf( esc_html__( '%s', 'himalayasunrise' ), get_the_date( esc_html_x( 'F Y', 'monthly archives date format', 'himalayasunrise' ) ) );

} elseif ( is_day() ) {

$title = sprintf( esc_html__( '%s', 'himalayasunrise' ), get_the_date( esc_html_x( 'F j, Y', 'daily archives date format', 'himalayasunrise' ) ) );

}elseif ( is_post_type_archive() ) {

$title = sprintf( esc_html__( '%s', 'himalayasunrise' ), post_type_archive_title( '', false ) );

} elseif ( is_tax() ) {

$tax = get_taxonomy( get_queried_object()->taxonomy );

$title = sprintf( esc_html__( '%s', 'himalayasunrise' ), single_term_title( '', false ) );

}

return $title;

}
add_filter('get_the_archive_title', 'ganesh_archive_title');

No comments:

Featured Post

Make money online

https://www.wpbeginner.com/beginners-guide/make-money-online/?fbclid=IwAR0_9_5aHmbB4rDisaPevdnO4uAgo0N9heHgPu1TjerjurE5ilD2NyzeB2A

Popular Posts