Tuesday, October 10, 2017

Function code to remove archive title from archive page


add_filter('get_the_archive_title', 'remove_archive_title');


function remove_archive_title($title){

  if ( is_category() ) {

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

  } elseif ( is_tag() ) {

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

  } elseif ( is_author() ) {

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

  } elseif ( is_year() ) {

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

  } elseif ( is_month() ) {

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

  } elseif ( is_day() ) {

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

  }elseif ( is_post_type_archive() ) {

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

  } elseif ( is_tax() ) {

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

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

  }

  return $title;

}

No comments:

Featured Post

Make money online

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

Popular Posts