Ticket #29808: 29808.8.diff
File 29808.8.diff, 5.1 KB (added by , 10 years ago) |
---|
-
src/wp-includes/link-template.php
2192 2192 * @param array $args { 2193 2193 * Optional. Default post navigation arguments. 2194 2194 * 2195 * @type string $prev_text Anchor text to display in the previous post link. 2196 * Default: `<span class="meta-nav">←</span> %title`. 2197 * @type string $next_text Anchor text to display in the next post link. 2198 * Default: `%title <span class="meta-nav">→</span>`. 2195 * @type string $prev_text Anchor text to display in the previous post link. Default: `%title`. 2196 * @type string $next_text Anchor text to display in the next post link. Default: `%title`. 2199 2197 * } 2200 2198 * @return string Markup for post links. 2201 2199 */ 2202 2200 function get_the_post_navigation( $args = array() ) { 2203 2201 $args = wp_parse_args( $args, array( 2204 'prev_text' => _x( '<span class="meta-nav">←</span> %title', 'Previous post link' ),2205 'next_text' => _x( '%title <span class="meta-nav">→</span>', 'Next post link' ),2202 'prev_text' => '%title', 2203 'next_text' => '%title', 2206 2204 ) ); 2207 2205 2208 2206 $navigation = ''; … … 2210 2208 $next = get_next_post_link( '<div class="nav-next">%link</div>', $args['next_text'] ); 2211 2209 2212 2210 // Only add markup if there's somewhere to navigate to. 2213 if ( $ next || $previous) {2214 $navigation = _navigation_markup( $ next . $previous, 'post-navigation', __( 'Post navigation' ) );2211 if ( $previous || $next ) { 2212 $navigation = _navigation_markup( $previous . $next, 'post-navigation', __( 'Post navigation' ) ); 2215 2213 } 2216 2214 2217 2215 return $navigation; … … 2238 2236 * @param array $args { 2239 2237 * Optional. Default paging navigation arguments. 2240 2238 * 2241 * @type string $prev_text Anchor text to display in the previous posts link. 2242 * Default: `<span class="meta-nav">←</span> Older posts`. 2243 * @type string $next_text Anchor text to display in the next posts link. 2244 * Default: `Newer posts <span class="meta-nav">→</span>`. 2239 * @type string $prev_text Anchor text to display in the previous posts link. Default: `Older posts`. 2240 * @type string $next_text Anchor text to display in the next posts link. Default: `Newer posts`. 2245 2241 * } 2246 2242 * @return string Markup for paging links. 2247 2243 */ … … 2251 2247 // Don't print empty markup if there's only one page. 2252 2248 if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { 2253 2249 $args = wp_parse_args( $args, array( 2254 'prev_text' => __( ' <span class="meta-nav">←</span>Older posts' ),2255 'next_text' => __( 'Newer posts <span class="meta-nav">→</span>' ),2250 'prev_text' => __( 'Older posts' ), 2251 'next_text' => __( 'Newer posts' ), 2256 2252 ) ); 2257 2253 2258 $next_link = get_ next_posts_link( $args['prev_text'] );2259 $prev_link = get_ previous_posts_link( $args['next_text'] );2254 $next_link = get_previous_posts_link( $args['next_text'] ); 2255 $prev_link = get_next_posts_link( $args['prev_text'] ); 2260 2256 2261 if ( $ next_link ) {2262 $navigation .= '<div class="nav-previous">' . $ next_link . '</div>';2257 if ( $prev_link ) { 2258 $navigation .= '<div class="nav-previous">' . $prev_link . '</div>'; 2263 2259 } 2264 2260 2265 if ( $ prev_link ) {2266 $navigation .= '<div class="nav-next">' . $ prev_link . '</div>';2261 if ( $next_link ) { 2262 $navigation .= '<div class="nav-next">' . $next_link . '</div>'; 2267 2263 } 2268 2264 2269 2265 $navigation = _navigation_markup( $navigation ); … … 2303 2299 * @type int $total The total amount of pages. Default: Value of 'max_num_pages' of current query. 2304 2300 * @type int $current The current page number. Default: Value of 'paged' query var. 2305 2301 * @type bool $prev_next Whether to include previous and next links. Default: true. 2306 * @type string $prev_text Anchor text to display in the previous posts link. Default: ` ←Previous`.2307 * @type string $next_text Anchor text to display in the next posts link. Default: `Next →`.2302 * @type string $prev_text Anchor text to display in the previous posts link. Default: `Previous`. 2303 * @type string $next_text Anchor text to display in the next posts link. Default: `Next`. 2308 2304 * @type bool $show_all Whether to show all pages. 2309 2305 * Default: false, shows short list of the pages near the current page. 2310 2306 * @type int $end_size Amount of numbers on either the start and the end list edges. Default: 1. … … 2324 2320 if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { 2325 2321 $args = wp_parse_args( $args, array( 2326 2322 'mid_size' => 1, 2327 'prev_text' => __( ' ←Previous' ),2328 'next_text' => __( 'Next →' ),2323 'prev_text' => __( 'Previous' ), 2324 'next_text' => __( 'Next' ), 2329 2325 ) ); 2330 2326 // Make sure we get plain links, so we can work with it. 2331 2327 $args['type'] = 'plain'; … … 2373 2369 2374 2370 $template = ' 2375 2371 <nav class="navigation %1$s" role="navigation"> 2376 <h 1 class="screen-reader-text">%2$s</h1>2372 <h2 class="screen-reader-text">%2$s</h2> 2377 2373 <div class="nav-links">%3$s</div> 2378 2374 </nav>'; 2379 2375