diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index 4d39696..9cfd384 100644
a
|
b
|
function single_month_title( $prefix = '', $display = true ) { |
1471 | 1471 | * Display the archive title based on the queried object. |
1472 | 1472 | * |
1473 | 1473 | * @since 4.1.0 |
| 1474 | * @since 5.0.3 Added $span_class parameter. |
1474 | 1475 | * |
1475 | 1476 | * @see get_the_archive_title() |
1476 | 1477 | * |
1477 | | * @param string $before Optional. Content to prepend to the title. Default empty. |
1478 | | * @param string $after Optional. Content to append to the title. Default empty. |
| 1478 | * @param string $before Optional. Content to prepend to the title. Default empty. |
| 1479 | * @param string $after Optional. Content to append to the title. Default empty. |
| 1480 | * @param string $span_class Optional. Class name to apply to the span around the archive type description. Default empty. |
1479 | 1481 | */ |
1480 | | function the_archive_title( $before = '', $after = '' ) { |
1481 | | $title = get_the_archive_title(); |
| 1482 | function the_archive_title( $before = '', $after = '', $span_class = '' ) { |
| 1483 | $title = get_the_archive_title( $span_class ); |
1482 | 1484 | |
1483 | 1485 | if ( ! empty( $title ) ) { |
1484 | 1486 | echo $before . $title . $after; |
… |
… |
function the_archive_title( $before = '', $after = '' ) { |
1489 | 1491 | * Retrieve the archive title based on the queried object. |
1490 | 1492 | * |
1491 | 1493 | * @since 4.1.0 |
| 1494 | * @since 5.0.3 Added $span_class parameter. |
1492 | 1495 | * |
| 1496 | * @param string $span_class Optional. Class name to apply to the span around the archive type description. Default empty. |
1493 | 1497 | * @return string Archive title. |
1494 | 1498 | */ |
1495 | | function get_the_archive_title() { |
| 1499 | function get_the_archive_title( $span_class = '' ) { |
1496 | 1500 | if ( is_category() ) { |
1497 | | /* translators: Category archive title. %s: Category name */ |
1498 | | $title = sprintf( __( 'Category: %s' ), single_cat_title( '', false ) ); |
| 1501 | /* translators: Category archive title. */ |
| 1502 | $type = __( 'Category:' ); |
| 1503 | $name = single_cat_title( '', false ); |
1499 | 1504 | } elseif ( is_tag() ) { |
1500 | | /* translators: Tag archive title. %s: Tag name */ |
1501 | | $title = sprintf( __( 'Tag: %s' ), single_tag_title( '', false ) ); |
| 1505 | /* translators: Tag archive title. */ |
| 1506 | $type = __( 'Tag:' ); |
| 1507 | $name = single_tag_title( '', false ); |
1502 | 1508 | } elseif ( is_author() ) { |
1503 | | /* translators: Author archive title. %s: Author name */ |
1504 | | $title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . get_the_author() . '</span>' ); |
| 1509 | /* translators: Author archive title. */ |
| 1510 | $type = __( 'Author:' ); |
| 1511 | /* translators: %s: Author name. */ |
| 1512 | $name = sprintf( '<span class="vcard">%s</span>', get_the_author() ); |
1505 | 1513 | } elseif ( is_year() ) { |
1506 | | /* translators: Yearly archive title. %s: Year */ |
1507 | | $title = sprintf( __( 'Year: %s' ), get_the_date( _x( 'Y', 'yearly archives date format' ) ) ); |
| 1514 | /* translators: Yearly archive title. */ |
| 1515 | $type = __( 'Year:' ); |
| 1516 | $name = get_the_date( _x( 'Y', 'yearly archives date format' ) ); |
1508 | 1517 | } elseif ( is_month() ) { |
1509 | | /* translators: Monthly archive title. %s: Month name and year */ |
1510 | | $title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ) ); |
| 1518 | /* translators: Monthly archive title. */ |
| 1519 | $type = __( 'Month:' ); |
| 1520 | $name = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); |
1511 | 1521 | } elseif ( is_day() ) { |
1512 | | /* translators: Daily archive title. %s: Date */ |
1513 | | $title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ) ); |
1514 | | } elseif ( is_tax( 'post_format' ) ) { |
| 1522 | /* translators: Daily archive title. */ |
| 1523 | $type = __( 'Day:' ); |
| 1524 | $name = get_the_date( _x( 'F j, Y', 'daily archives date format' ) ); |
| 1525 | } elseif ( is_post_type_archive() ) { |
| 1526 | /* translators: Post type archive title. */ |
| 1527 | $type = __( 'Archives:' ); |
| 1528 | $name = post_type_archive_title( '', false ); |
| 1529 | } elseif ( is_tax() ) { |
| 1530 | $tax = get_taxonomy( get_queried_object()->taxonomy ); |
| 1531 | /* translators: Taxonomy singular name */ |
| 1532 | $type = sprintf( __( '%s:' ), $tax->labels->singular_name ); |
| 1533 | $name = single_term_title( '', false ); |
| 1534 | } |
| 1535 | |
| 1536 | if ( is_tax( 'post_format' ) ) { |
1515 | 1537 | if ( is_tax( 'post_format', 'post-format-aside' ) ) { |
1516 | 1538 | $title = _x( 'Asides', 'post format archive title' ); |
1517 | 1539 | } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) { |
… |
… |
function get_the_archive_title() { |
1531 | 1553 | } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) { |
1532 | 1554 | $title = _x( 'Chats', 'post format archive title' ); |
1533 | 1555 | } |
1534 | | } elseif ( is_post_type_archive() ) { |
1535 | | /* translators: Post type archive title. %s: Post type name */ |
1536 | | $title = sprintf( __( 'Archives: %s' ), post_type_archive_title( '', false ) ); |
1537 | | } elseif ( is_tax() ) { |
1538 | | $tax = get_taxonomy( get_queried_object()->taxonomy ); |
1539 | | /* translators: Taxonomy term archive title. 1: Taxonomy singular name, 2: Current taxonomy term */ |
1540 | | $title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) ); |
| 1556 | } elseif ( isset( $type ) && isset( $name ) ) { |
| 1557 | if ( ! empty( $span_class ) ) { |
| 1558 | $span_class = sprintf( ' class="%s"', esc_attr( $span_class ) ); |
| 1559 | $title = sprintf( '<span%s>%s </span>%s', $span_class, $type, $name ); |
| 1560 | } else { |
| 1561 | $title = sprintf( '%s %s', $type, $name ); |
| 1562 | } |
1541 | 1563 | } else { |
1542 | 1564 | $title = __( 'Archives' ); |
1543 | 1565 | } |
… |
… |
function get_the_archive_title() { |
1546 | 1568 | * Filters the archive title. |
1547 | 1569 | * |
1548 | 1570 | * @since 4.1.0 |
| 1571 | * @since 5.0.3 Added $span_class parameter. |
1549 | 1572 | * |
1550 | 1573 | * @param string $title Archive title to be displayed. |
| 1574 | * @param string $span_class Optional. Class name to apply to the span around the archive type description. Default empty. |
1551 | 1575 | */ |
1552 | | return apply_filters( 'get_the_archive_title', $title ); |
| 1576 | return apply_filters( 'get_the_archive_title', $title, $span_class ); |
1553 | 1577 | } |
1554 | 1578 | |
1555 | 1579 | /** |