Changeset 42440
- Timestamp:
- 01/12/2018 08:16:56 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-template.php
r42343 r42440 863 863 * 864 864 * @since 1.2.0 865 * @since 5.0.0 Added the `aria_current` argument. 865 866 * 866 867 * @global int $page … … 878 879 * @type string $link_after HTML or text to append to each Pages link inside the `<a>` tag. 879 880 * Also appended to the current item, which is not linked. Default empty. 881 * @type string $aria_current The value for the aria-current attribute. Possible values are 'page', 882 * 'step', 'location', 'date', 'time', 'true', 'false'. Default is 'page'. 880 883 * @type string $next_or_number Indicates whether page numbers should be used. Valid values are number 881 884 * and next. Default is 'number'. … … 894 897 895 898 $defaults = array( 896 'before' => '<p >' . __( 'Pages:' ),899 'before' => '<p class="post-nav-links">' . __( 'Pages:' ), 897 900 'after' => '</p>', 898 901 'link_before' => '', 899 902 'link_after' => '', 903 'aria_current' => 'page', 900 904 'next_or_number' => 'number', 901 905 'separator' => ' ', … … 925 929 if ( $i != $page || ! $more && 1 == $page ) { 926 930 $link = _wp_link_page( $i ) . $link . '</a>'; 931 } elseif ( $i === $page ) { 932 $link = '<span class="post-page-numbers current" aria-current="' . esc_attr( $r['aria_current'] ) . '">' . $link . '</span>'; 927 933 } 928 934 /** … … 1018 1024 } 1019 1025 1020 return '<a href="' . esc_url( $url ) . '" >';1026 return '<a href="' . esc_url( $url ) . '" class="post-page-numbers">'; 1021 1027 } 1022 1028 -
trunk/tests/phpunit/tests/post/template.php
r42343 r42440 15 15 setup_postdata( get_post( $post_id ) ); 16 16 17 $permalink = sprintf( '<a href="%s" >', get_permalink() );17 $permalink = sprintf( '<a href="%s" class="post-page-numbers">', get_permalink() ); 18 18 $page2 = _wp_link_page( 2 ); 19 19 $page3 = _wp_link_page( 3 ); 20 20 21 $expected = "<p>Pages: 1 {$page2}2</a> {$page3}3</a></p>";21 $expected = '<p class="post-nav-links">Pages: <span class="post-page-numbers current" aria-current="page">1</span> ' . $page2 . '2</a> ' . $page3 . '3</a></p>'; 22 22 $output = wp_link_pages( array( 'echo' => 0 ) ); 23 23 24 24 $this->assertEquals( $expected, $output ); 25 25 26 $before_after = " 1{$page2}2</a> {$page3}3</a>";26 $before_after = " <span class=\"post-page-numbers current\" aria-current=\"page\">1</span> {$page2}2</a> {$page3}3</a>"; 27 27 $output = wp_link_pages( 28 28 array( … … 35 35 $this->assertEquals( $before_after, $output ); 36 36 37 $separator = " 1{$page2}2</a>{$page3}3</a>";37 $separator = " <span class=\"post-page-numbers current\" aria-current=\"page\">1</span>{$page2}2</a>{$page3}3</a>"; 38 38 $output = wp_link_pages( 39 39 array( … … 47 47 $this->assertEquals( $separator, $output ); 48 48 49 $link = " < em>1</em>{$page2}<em>2</em></a>{$page3}<em>3</em></a>";49 $link = " <span class=\"post-page-numbers current\" aria-current=\"page\"><em>1</em></span>{$page2}<em>2</em></a>{$page3}<em>3</em></a>"; 50 50 $output = wp_link_pages( 51 51 array( … … 108 108 109 109 $GLOBALS['page'] = 1; 110 $separator = "<p >Pages: 1| {$page2}2</a> | {$page3}3</a></p>";110 $separator = "<p class=\"post-nav-links\">Pages: <span class=\"post-page-numbers current\" aria-current=\"page\">1</span> | {$page2}2</a> | {$page3}3</a></p>"; 111 111 $output = wp_link_pages( 112 112 array( … … 118 118 $this->assertEquals( $separator, $output ); 119 119 120 $pagelink = " Page 1| {$page2}Page 2</a> | {$page3}Page 3</a>";120 $pagelink = " <span class=\"post-page-numbers current\" aria-current=\"page\">Page 1</span> | {$page2}Page 2</a> | {$page3}Page 3</a>"; 121 121 $output = wp_link_pages( 122 122 array(
Note: See TracChangeset
for help on using the changeset viewer.