diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index 11d4b77..e7d5e14 100644
|
a
|
b
|
function get_the_post_type_description() { |
| 1660 | 1660 | * |
| 1661 | 1661 | * @since 1.0.0 |
| 1662 | 1662 | * |
| 1663 | | * @param string $url URL to archive. |
| 1664 | | * @param string $text Archive text description. |
| 1665 | | * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom. |
| 1666 | | * @param string $before Optional. Content to prepend to the description. Default empty. |
| 1667 | | * @param string $after Optional. Content to append to the description. Default empty. |
| | 1663 | * @param string $url URL to archive. |
| | 1664 | * @param string $text Archive text description. |
| | 1665 | * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom. |
| | 1666 | * @param string $before Optional. Content to prepend to the description. Default empty. |
| | 1667 | * @param string $after Optional. Content to append to the description. Default empty. |
| | 1668 | * @param bool $selected Optional. Set to true if the current page is the selected archive page. |
| 1668 | 1669 | * @return string HTML link content for archive. |
| 1669 | 1670 | */ |
| 1670 | | function get_archives_link( $url, $text, $format = 'html', $before = '', $after = '' ) { |
| | 1671 | function get_archives_link( $url, $text, $format = 'html', $before = '', $after = '', $selected = false ) { |
| 1671 | 1672 | $text = wptexturize( $text ); |
| 1672 | 1673 | $url = esc_url( $url ); |
| 1673 | 1674 | |
| 1674 | 1675 | if ( 'link' == $format ) { |
| 1675 | 1676 | $link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n"; |
| 1676 | | } elseif ( 'option' == $format ) { |
| 1677 | | $link_html = "\t<option value='$url'>$before $text $after</option>\n"; |
| | 1677 | } elseif ('option' == $format) { |
| | 1678 | $selected_attr = $selected ? " selected='selected'" : ''; |
| | 1679 | $link_html = "\t<option value='$url'$selected_attr>$before $text $after</option>\n"; |
| 1678 | 1680 | } elseif ( 'html' == $format ) { |
| 1679 | 1681 | $link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n"; |
| 1680 | 1682 | } else { // custom |
| … |
… |
function get_archives_link( $url, $text, $format = 'html', $before = '', $after |
| 1686 | 1688 | * |
| 1687 | 1689 | * @since 2.6.0 |
| 1688 | 1690 | * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters. |
| | 1691 | * @since 5.2.0 Added the `$selected` parameter. |
| 1689 | 1692 | * |
| 1690 | 1693 | * @param string $link_html The archive HTML link content. |
| 1691 | 1694 | * @param string $url URL to archive. |
| … |
… |
function get_archives_link( $url, $text, $format = 'html', $before = '', $after |
| 1693 | 1696 | * @param string $format Link format. Can be 'link', 'option', 'html', or custom. |
| 1694 | 1697 | * @param string $before Content to prepend to the description. |
| 1695 | 1698 | * @param string $after Content to append to the description. |
| | 1699 | * @param bool $selected True if the current page is the selected archive. |
| 1696 | 1700 | */ |
| 1697 | | return apply_filters( 'get_archives_link', $link_html, $url, $text, $format, $before, $after ); |
| | 1701 | return apply_filters( 'get_archives_link', $link_html, $url, $text, $format, $before, $after, $selected ); |
| 1698 | 1702 | } |
| 1699 | 1703 | |
| 1700 | 1704 | /** |
| … |
… |
function get_archives_link( $url, $text, $format = 'html', $before = '', $after |
| 1702 | 1706 | * |
| 1703 | 1707 | * @since 1.2.0 |
| 1704 | 1708 | * @since 4.4.0 $post_type arg was added. |
| | 1709 | * @since 5.2.0 $year, $monthnum, $day, $w args were added. |
| 1705 | 1710 | * |
| 1706 | 1711 | * @see get_archives_link() |
| 1707 | 1712 | * |
| … |
… |
function get_archives_link( $url, $text, $format = 'html', $before = '', $after |
| 1729 | 1734 | * @type string $order Whether to use ascending or descending order. Accepts 'ASC', or 'DESC'. |
| 1730 | 1735 | * Default 'DESC'. |
| 1731 | 1736 | * @type string $post_type Post type. Default 'post'. |
| | 1737 | * @type string $year Year. Default current year. |
| | 1738 | * @type string $monthnum Month number. Default current month number. |
| | 1739 | * @type string $day Day. Default current day. |
| | 1740 | * @type string $w Week. Default current week. |
| 1732 | 1741 | * } |
| 1733 | 1742 | * @return string|void String when retrieving. |
| 1734 | 1743 | */ |
| … |
… |
function wp_get_archives( $args = '' ) { |
| 1745 | 1754 | 'echo' => 1, |
| 1746 | 1755 | 'order' => 'DESC', |
| 1747 | 1756 | 'post_type' => 'post', |
| | 1757 | 'year' => get_query_var( 'year' ), |
| | 1758 | 'monthnum' => get_query_var( 'monthnum' ), |
| | 1759 | 'day' => get_query_var( 'day' ), |
| | 1760 | 'w' => get_query_var( 'w' ), |
| 1748 | 1761 | ); |
| 1749 | 1762 | |
| 1750 | 1763 | $r = wp_parse_args( $args, $defaults ); |
| … |
… |
function wp_get_archives( $args = '' ) { |
| 1820 | 1833 | if ( $r['show_post_count'] ) { |
| 1821 | 1834 | $r['after'] = ' (' . $result->posts . ')' . $after; |
| 1822 | 1835 | } |
| 1823 | | $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
| | 1836 | $selected = is_archive() && ( string ) $r[ 'year' ] === $result->year && ( string ) $r[ 'monthnum' ] === $result->month; |
| | 1837 | $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected ); |
| 1824 | 1838 | } |
| 1825 | 1839 | } |
| 1826 | 1840 | } elseif ( 'yearly' == $r['type'] ) { |
| … |
… |
function wp_get_archives( $args = '' ) { |
| 1842 | 1856 | if ( $r['show_post_count'] ) { |
| 1843 | 1857 | $r['after'] = ' (' . $result->posts . ')' . $after; |
| 1844 | 1858 | } |
| 1845 | | $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
| | 1859 | $selected = is_archive() && ( string ) $r[ 'year' ] === $result->year; |
| | 1860 | $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected ); |
| 1846 | 1861 | } |
| 1847 | 1862 | } |
| 1848 | 1863 | } elseif ( 'daily' == $r['type'] ) { |
| … |
… |
function wp_get_archives( $args = '' ) { |
| 1865 | 1880 | if ( $r['show_post_count'] ) { |
| 1866 | 1881 | $r['after'] = ' (' . $result->posts . ')' . $after; |
| 1867 | 1882 | } |
| 1868 | | $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
| | 1883 | $selected = is_archive() && ( string ) $r[ 'year' ] === $result->year && ( string ) $r[ 'monthnum' ] === $result->month && ( string ) $r[ 'day' ] === $result->dayofmonth; |
| | 1884 | $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected ); |
| 1869 | 1885 | } |
| 1870 | 1886 | } |
| 1871 | 1887 | } elseif ( 'weekly' == $r['type'] ) { |
| … |
… |
function wp_get_archives( $args = '' ) { |
| 1901 | 1917 | if ( $r['show_post_count'] ) { |
| 1902 | 1918 | $r['after'] = ' (' . $result->posts . ')' . $after; |
| 1903 | 1919 | } |
| 1904 | | $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
| | 1920 | $selected = is_archive() && ( string ) $r[ 'year' ] === $result->yr && ( string ) $r[ 'week' ] === $result->week; |
| | 1921 | $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected ); |
| 1905 | 1922 | } |
| 1906 | 1923 | } |
| 1907 | 1924 | } |
| … |
… |
function wp_get_archives( $args = '' ) { |
| 1924 | 1941 | } else { |
| 1925 | 1942 | $text = $result->ID; |
| 1926 | 1943 | } |
| 1927 | | $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
| | 1944 | $selected = $result->ID === get_the_ID(); |
| | 1945 | $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected ); |
| 1928 | 1946 | } |
| 1929 | 1947 | } |
| 1930 | 1948 | } |