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