Ticket #39447: 39447-2.diff
| File 39447-2.diff, 2.3 KB (added by , 6 years ago) |
|---|
-
link-template.php
2646 2646 * Default 'Posts navigation'. 2647 2647 * @type string $aria_label ARIA label text for the nav element. Default 'Posts'. 2648 2648 * @type string $class Custom class for the nav element. Default 'posts-navigation'. 2649 * @type int $max_num_pages Total amount of pages. 2650 * Default global `$wp_query->max_num_pages` 2649 2651 * } 2650 2652 * @return string Markup for posts links. 2651 2653 */ 2652 2654 function get_the_posts_navigation( $args = array() ) { 2655 global $wp_query; 2656 2653 2657 $navigation = ''; 2654 2658 2659 // Make sure the nav element has an aria-label attribute: fallback to the screen reader text. 2660 if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { 2661 $args['aria_label'] = $args['screen_reader_text']; 2662 } 2663 2664 $args = wp_parse_args( 2665 $args, 2666 array( 2667 'prev_text' => __( 'Older posts' ), 2668 'next_text' => __( 'Newer posts' ), 2669 'screen_reader_text' => __( 'Posts navigation' ), 2670 'aria_label' => __( 'Posts' ), 2671 'class' => 'posts-navigation', 2672 'max_num_pages' => $wp_query->max_num_pages, 2673 ) 2674 ); 2675 2655 2676 // Don't print empty markup if there's only one page. 2656 if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { 2657 // Make sure the nav element has an aria-label attribute: fallback to the screen reader text. 2658 if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { 2659 $args['aria_label'] = $args['screen_reader_text']; 2660 } 2677 if ( $args['max_num_pages'] > 1 ) { 2661 2678 2662 $args = wp_parse_args(2663 $args,2664 array(2665 'prev_text' => __( 'Older posts' ),2666 'next_text' => __( 'Newer posts' ),2667 'screen_reader_text' => __( 'Posts navigation' ),2668 'aria_label' => __( 'Posts' ),2669 'class' => 'posts-navigation',2670 )2671 );2672 2673 2679 $next_link = get_previous_posts_link( $args['next_text'] ); 2674 $prev_link = get_next_posts_link( $args['prev_text'] );2680 $prev_link = get_next_posts_link( $args['prev_text'], $args['max_num_pages'] ); 2675 2681 2676 2682 if ( $prev_link ) { 2677 2683 $navigation .= '<div class="nav-previous">' . $prev_link . '</div>';
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)