Changeset 48294
- Timestamp:
- 07/04/2020 02:43:32 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r48283 r48294 1605 1605 */ 1606 1606 function get_the_archive_title() { 1607 $title = __( 'Archives' ); 1607 $title = __( 'Archives' ); 1608 $prefix = ''; 1608 1609 1609 1610 if ( is_category() ) { 1610 /* translators: Category archive title. %s: Category name. */1611 $ title = sprintf( __( 'Category: %s' ), single_cat_title( '', false ));1611 $title = single_cat_title( '', false ); 1612 $prefix = _x( 'Category:', 'category archive title prefix' ); 1612 1613 } elseif ( is_tag() ) { 1613 /* translators: Tag archive title. %s: Tag name. */1614 $ title = sprintf( __( 'Tag: %s' ), single_tag_title( '', false ));1614 $title = single_tag_title( '', false ); 1615 $prefix = _x( 'Tag:', 'tag archive title prefix' ); 1615 1616 } elseif ( is_author() ) { 1616 /* translators: Author archive title. %s: Author name. */1617 $ title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . get_the_author() . '</span>' );1617 $title = get_the_author(); 1618 $prefix = _x( 'Author:', 'author archive title prefix' ); 1618 1619 } elseif ( is_year() ) { 1619 /* translators: Yearly archive title. %s: Year. */1620 $ title = sprintf( __( 'Year: %s' ), get_the_date( _x( 'Y', 'yearly archives date format' ) ));1620 $title = get_the_date( _x( 'Y', 'yearly archives date format' ) ); 1621 $prefix = _x( 'Year:', 'date archive title prefix' ); 1621 1622 } elseif ( is_month() ) { 1622 /* translators: Monthly archive title. %s: Month name and year. */1623 $ title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ));1623 $title = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); 1624 $prefix = _x( 'Month:', 'date archive title prefix' ); 1624 1625 } elseif ( is_day() ) { 1625 /* translators: Daily archive title. %s: Date. */1626 $ title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ));1626 $title = get_the_date( _x( 'F j, Y', 'daily archives date format' ) ); 1627 $prefix = _x( 'Day:', 'date archive title prefix' ); 1627 1628 } elseif ( is_tax( 'post_format' ) ) { 1628 1629 if ( is_tax( 'post_format', 'post-format-aside' ) ) { … … 1646 1647 } 1647 1648 } elseif ( is_post_type_archive() ) { 1648 /* translators: Post type archive title. %s: Post type name. */1649 $ title = sprintf( __( 'Archives: %s' ), post_type_archive_title( '', false ));1649 $title = post_type_archive_title( '', false ); 1650 $prefix = _x( 'Archives:', 'post type archive title prefix' ); 1650 1651 } elseif ( is_tax() ) { 1651 1652 $queried_object = get_queried_object(); 1652 1653 if ( $queried_object ) { 1653 $tax = get_taxonomy( $queried_object->taxonomy ); 1654 /* translators: Taxonomy term archive title. 1: Taxonomy singular name, 2: Current taxonomy term. */ 1655 $title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) ); 1656 } 1654 $tax = get_taxonomy( $queried_object->taxonomy ); 1655 $title = single_term_title( '', false ); 1656 $prefix = sprintf( 1657 /* translators: %s: Taxonomy singular name. */ 1658 _x( '%s:', 'taxonomy term archive title prefix' ), 1659 $tax->labels->singular_name 1660 ); 1661 } 1662 } 1663 1664 $original_title = $title; 1665 1666 /** 1667 * Filters the archive title prefix. 1668 * 1669 * @since 5.5.0 1670 * 1671 * @param string $prefix Archive title prefix. 1672 */ 1673 $prefix = apply_filters( 'get_the_archive_title_prefix', $prefix ); 1674 if ( $prefix ) { 1675 $title = sprintf( 1676 /* translators: 1: Title prefix. 2: Title. */ 1677 _x( '%1$s %2$s', 'archive title' ), 1678 $prefix, 1679 '<span>' . $title . '</span>' 1680 ); 1657 1681 } 1658 1682 … … 1661 1685 * 1662 1686 * @since 4.1.0 1663 * 1664 * @param string $title Archive title to be displayed. 1665 */ 1666 return apply_filters( 'get_the_archive_title', $title ); 1687 * @since 5.5.0 Added the `$prefix` and `$original_title` parameters. 1688 * 1689 * @param string $title Archive title to be displayed. 1690 * @param string $original_title Archive title without prefix. 1691 * @param string $prefix Archive title prefix. 1692 */ 1693 return apply_filters( 'get_the_archive_title', $title, $original_title, $prefix ); 1667 1694 } 1668 1695
Note: See TracChangeset
for help on using the changeset viewer.