<?php
/**
 * Filters for get_the_archive_title()
 *
 * @package Bidnis
 * @since   Bidnis 2.0
 */

/**
 * Remove prefix from archive titles
 *
 * @param string $title Archive title with prefix.
 *
 * @return string $title Archive title without prefix.
 */
function bidnis_get_the_archive_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_year() ) {
    $title = get_the_date( _x( 'Y', 'yearly archives date format', 'bidnis' ) );
  } elseif ( is_month() ) {
    $title = get_the_date( _x( 'F Y', 'monthly archives date format', 'bidnis' ) );
  } elseif ( is_day() ) {
    $title = get_the_date( _x( 'F j, Y', 'daily archives date format', 'bidnis' ) );
  } elseif ( is_post_type_archive() ) {
    $title = post_type_archive_title( '', false );
  }

  return $title;
}
add_filter( 'get_the_archive_title', 'bidnis_get_the_archive_title' );
