Changeset 30457
- Timestamp:
- 11/20/2014 03:18:53 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r30263 r30457 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`. 2197 * @type string $screen_reader_text Screen reader text for nav element. Default: 'Post navigation'. 2199 2198 * } 2200 2199 * @return string Markup for post links. … … 2202 2201 function get_the_post_navigation( $args = array() ) { 2203 2202 $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' ), 2203 'prev_text' => '%title', 2204 'next_text' => '%title', 2205 'screen_reader_text' => __( 'Post navigation' ), 2206 2206 ) ); 2207 2207 … … 2211 2211 2212 2212 // Only add markup if there's somewhere to navigate to. 2213 if ( $ next || $previous) {2214 $navigation = _navigation_markup( $ next . $previous, 'post-navigation', __( 'Post navigation' ));2213 if ( $previous || $next ) { 2214 $navigation = _navigation_markup( $previous . $next, 'post-navigation', $args['screen_reader_text'] ); 2215 2215 } 2216 2216 … … 2239 2239 * Optional. Default paging navigation arguments. 2240 2240 * 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>`. 2241 * @type string $prev_text Anchor text to display in the previous posts link. Default: `Older posts`. 2242 * @type string $next_text Anchor text to display in the next posts link. Default: `Newer posts`. 2243 * @type string $screen_reader_text Screen reader text for nav element. Default: 'Posts navigation'. 2245 2244 * } 2246 2245 * @return string Markup for paging links. … … 2252 2251 if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { 2253 2252 $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>' ), 2253 'prev_text' => __( 'Older posts' ), 2254 'next_text' => __( 'Newer posts' ), 2255 'screen_reader_text' => __( 'Posts navigation' ), 2256 2256 ) ); 2257 2257 2258 $next_link = get_next_posts_link( $args['prev_text'] ); 2259 $prev_link = get_previous_posts_link( $args['next_text'] ); 2258 $next_link = get_previous_posts_link( $args['next_text'] ); 2259 $prev_link = get_next_posts_link( $args['prev_text'] ); 2260 2261 if ( $prev_link ) { 2262 $navigation .= '<div class="nav-previous">' . $prev_link . '</div>'; 2263 } 2260 2264 2261 2265 if ( $next_link ) { 2262 $navigation .= '<div class="nav- previous">' . $next_link . '</div>';2266 $navigation .= '<div class="nav-next">' . $next_link . '</div>'; 2263 2267 } 2264 2268 2265 if ( $prev_link ) { 2266 $navigation .= '<div class="nav-next">' . $prev_link . '</div>'; 2267 } 2268 2269 $navigation = _navigation_markup( $navigation ); 2269 $navigation = _navigation_markup( $navigation, 'paging-navigation', $args['screen_reader_text'] ); 2270 2270 } 2271 2271 … … 2291 2291 * 2292 2292 * @param array $args { 2293 * Optional. Default pagination arguments. 2294 * 2295 * @type string $base URL to be used to create the paginated links. 2296 * Example: `http://example.com/all_posts.php%_%` 2297 * The `%_%` is required and will be replaced by the contents of the 2298 * 'format' argument. 2299 * Default: Current page number link with appended `%_%`. 2300 * @type string $format Used to replace the page number. Example: `?page=%#%` 2301 * The `%#%` is required and will be replaced with the page number. 2302 * Default: Current permalink format with appended `%#%`. 2303 * @type int $total The total amount of pages. Default: Value of 'max_num_pages' of current query. 2304 * @type int $current The current page number. Default: Value of 'paged' query var. 2305 * @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 →`. 2308 * @type bool $show_all Whether to show all pages. 2309 * Default: false, shows short list of the pages near the current page. 2310 * @type int $end_size Amount of numbers on either the start and the end list edges. Default: 1. 2311 * @type int $mid_size Amount of numbers to either side of current page but not including current page. 2312 * Default: 1. 2313 * @type array $add_args Query vars to be added to the links. Accepts an associative array of arguments. 2314 * Default: Empty array. 2315 * @type string $before_page_number Text to prepend to the anchor text. Default: Empty string. 2316 * @type string $after_page_number Text to append to the anchor text. Default: Empty string. 2293 * Optional. Default pagination arguments. {@see paginate_links()} 2294 * 2295 * @type string $screen_reader_text Screen reader text for navigation element. Default: 'Posts navigation'. 2317 2296 * } 2318 2297 * @return string Markup for pagination links. … … 2324 2303 if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { 2325 2304 $args = wp_parse_args( $args, array( 2326 'mid_size' => 1, 2327 'prev_text' => __( '← Previous' ), 2328 'next_text' => __( 'Next →' ), 2305 'mid_size' => 1, 2306 'prev_text' => __( 'Previous' ), 2307 'next_text' => __( 'Next' ), 2308 'screen_reader_text' => __( 'Posts navigation' ), 2329 2309 ) ); 2330 2310 // Make sure we get plain links, so we can work with it. … … 2334 2314 $links = paginate_links( $args ); 2335 2315 2336 // `navigation_markup()` expects a string, `paginate_links()` can return an array. 2337 if ( $links && ! is_array( $links ) ) { 2338 $navigation = _navigation_markup( $links, 'pagination' ); 2316 if ( $links ) { 2317 $navigation = _navigation_markup( $links, 'pagination', $args['screen_reader_text'] ); 2339 2318 } 2340 2319 } … … 2373 2352 $template = ' 2374 2353 <nav class="navigation %1$s" role="navigation"> 2375 <h 1 class="screen-reader-text">%2$s</h1>2354 <h2 class="screen-reader-text">%2$s</h2> 2376 2355 <div class="nav-links">%3$s</div> 2377 2356 </nav>';
Note: See TracChangeset
for help on using the changeset viewer.