Ticket #40108: 40108.2.patch
File 40108.2.patch, 4.2 KB (added by , 5 years ago) |
---|
-
post-template.php
862 862 * Quicktag one or more times). This tag must be within The Loop. 863 863 * 864 864 * @since 1.2.0 865 * @since 5.0.0 Added the `aria_current` argument .865 * @since 5.0.0 Added the `aria_current` argument and `mixed` as possible value for `next_or_number` argument 866 866 * 867 867 * @global int $page 868 868 * @global int $numpages … … 880 880 * Also appended to the current item, which is not linked. Default empty. 881 881 * @type string $aria_current The value for the aria-current attribute. Possible values are 'page', 882 882 * 'step', 'location', 'date', 'time', 'true', 'false'. Default is 'page'. 883 * @type string $next_or_number Indicates whether page numbers should be used. Valid values are number884 * and next. Default is 'number'.883 * @type string $next_or_number Controls the formatting of navigation links. Valid values are 'next', 'number' 884 * and 'mixed'. Default is 'number'. 885 885 * @type string $separator Text between pagination links. Default is ' '. 886 886 * @type string $nextpagelink Link text for the next page link, if available. Default is 'Next Page'. 887 887 * @type string $previouspagelink Link text for the previous page link, if available. Default is 'Previous Page'. … … 902 902 'link_after' => '', 903 903 'aria_current' => 'page', 904 904 'next_or_number' => 'number', 905 'navwidth' => '3', 905 906 'separator' => ' ', 906 907 'nextpagelink' => __( 'Next page' ), 907 908 'previouspagelink' => __( 'Previous page' ), … … 954 955 955 956 /** This filter is documented in wp-includes/post-template.php */ 956 957 $output .= apply_filters( 'wp_link_pages_link', $link, $prev ); 957 } 958 959 // Output number of links equal to $navwidth before current page 960 if ( 'mixed' == $r['next_or_number'] ) { 961 For ( $i = $page - $navwidth; $i < $page; $i++) { 962 if ( $i > 0) { 963 $link = _wp_link_page( $i ) . $r['link_before'] . str_replace( '%', $i, $r['pagelink'] ) . $r['link_after'] . '</a>'; 964 $link = apply_filters( 'wp_link_pages_link', $link, $i ); 965 966 // Use the custom links separator beginning with the second link. 967 $output .= ( 1 === $i ) ? ' ' : $r['separator']; 968 $output .= $link 969 } 970 } 971 // Output current page within <span> tags for enhanced styling capability 972 if ( $prev ) { 973 $output .= $r['separator']; 974 } 975 $output .= $r['link_before'] . ('<span class="post-page-numbers current" aria-current="' . esc_attr( $r['aria_current'] ) . '">') . str_replace( '%', $i, $r['pagelink'] ) . ('</span>') . $r['link_after']; 976 977 // Output number of links equal to $navwidth after current page 978 For ($i = $page + 1; $i <= $numpages; $i++) { 979 $link = _wp_link_page( $i ) . $r['link_before'] . str_replace( '%', $i, $r['pagelink'] ) . $r['link_after'] . '</a>'; 980 $link = apply_filters( 'wp_link_pages_link', $link, $i ); 981 $output .= $r['separator'] . $link; 982 } 983 } 958 984 $next = $page + 1; 959 985 if ( $next <= $numpages ) { 960 986 if ( $prev ) {