1462 | | function get_the_archive_title() { |
1463 | | if ( is_category() ) { |
1464 | | /* translators: Category archive title. 1: Category name */ |
1465 | | $title = sprintf( __( 'Category: %s' ), single_cat_title( '', false ) ); |
1466 | | } elseif ( is_tag() ) { |
1467 | | /* translators: Tag archive title. 1: Tag name */ |
1468 | | $title = sprintf( __( 'Tag: %s' ), single_tag_title( '', false ) ); |
1469 | | } elseif ( is_author() ) { |
1470 | | /* translators: Author archive title. 1: Author name */ |
1471 | | $title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . get_the_author() . '</span>' ); |
1472 | | } elseif ( is_year() ) { |
1473 | | /* translators: Yearly archive title. 1: Year */ |
1474 | | $title = sprintf( __( 'Year: %s' ), get_the_date( _x( 'Y', 'yearly archives date format' ) ) ); |
1475 | | } elseif ( is_month() ) { |
1476 | | /* translators: Monthly archive title. 1: Month name and year */ |
1477 | | $title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ) ); |
1478 | | } elseif ( is_day() ) { |
1479 | | /* translators: Daily archive title. 1: Date */ |
1480 | | $title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ) ); |
| 1462 | function get_the_archive_title( $span_class = '' ) { |
| 1463 | if ( is_category() || is_tag() || is_author() || is_year() || is_month() || is_day() || is_post_type_archive() || ( is_tax() && ! is_tax( 'post_format') ) ) { |
| 1464 | if ( ! '' == $span_class ) { |
| 1465 | $span_class = sprintf( 'class="%s"', $span_class ); |
| 1466 | } |
| 1467 | if ( is_category() ) { |
| 1468 | /* translators: Category archive title. 1: Category name */ |
| 1469 | $type = __( 'Category: ' ); |
| 1470 | $name = single_cat_title( '', false ); |
| 1471 | } elseif ( is_tag() ) { |
| 1472 | /* translators: Tag archive title. 1: Tag name */ |
| 1473 | $type = __( 'Tag: ' ); |
| 1474 | $name = single_tag_title( '', false ); |
| 1475 | } elseif ( is_author() ) { |
| 1476 | /* translators: Author archive title. 1: Author name */ |
| 1477 | $type = __( 'Author: ' ); |
| 1478 | $name = sprintf( '<span class="vcard">%s</span>', get_the_author() ); |
| 1479 | } elseif ( is_year() ) { |
| 1480 | /* translators: Yearly archive title. 1: Year */ |
| 1481 | $type = __( 'Year: ' ); |
| 1482 | $name = get_the_date( _x( 'Y', 'yearly archives date format' ) ); |
| 1483 | } elseif ( is_month() ) { |
| 1484 | /* translators: Monthly archive title. 1: Month name and year */ |
| 1485 | $type = __( 'Month: ' ); |
| 1486 | $name = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); |
| 1487 | } elseif ( is_day() ) { |
| 1488 | /* translators: Daily archive title. 1: Date */ |
| 1489 | $type =__( 'Day: ' ); |
| 1490 | $name = get_the_date( _x( 'F j, Y', 'daily archives date format' ) ); |
| 1491 | } elseif ( is_post_type_archive() ) { |
| 1492 | /* translators: Post type archive title. 1: Post type name */ |
| 1493 | $type = __( 'Archives: ' ); |
| 1494 | $name = post_type_archive_title( '', false ); |
| 1495 | } elseif ( is_tax() ) { |
| 1496 | $tax = get_taxonomy( get_queried_object()->taxonomy ); |
| 1497 | /* translators: Taxonomy term archive title. 1: Taxonomy singular name */ |
| 1498 | $type = sprintf( __( '%s: ' ), $tax->labels->singular_name ); |
| 1499 | $name = single_term_title( '', false ); |
| 1500 | } |
| 1501 | $format ='<span %s>%s</span>%s'; |
| 1502 | $title = sprintf( $format, $span_class, $type, $name ); |