Make WordPress Core

Ticket #39447: 39447.3.diff

File 39447.3.diff, 2.4 KB (added by garrett-eclipse, 4 years ago)

Minor Refresh

  • src/wp-includes/link-template.php

     
    26482648 *                                      Default 'Posts navigation'.
    26492649 *     @type string $aria_label         ARIA label text for the nav element. Default 'Posts'.
    26502650 *     @type string $class              Custom class for the nav element. Default 'posts-navigation'.
     2651 *     @type int $max_num_pages         Maximum number of pages.
     2652 *                                      Default to global `$wp_query->max_num_pages`.
    26512653 * }
    26522654 * @return string Markup for posts links.
    26532655 */
     
    26542656function get_the_posts_navigation( $args = array() ) {
    26552657        $navigation = '';
    26562658
    2657         // Don't print empty markup if there's only one page.
    2658         if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
    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                 }
     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        }
    26632663
    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                         )
    2673                 );
     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        );
    26742675
     2676        // Don't print empty markup if there's only one page.
     2677        if ( $args['max_num_pages'] > 1 ) {
    26752678                $next_link = get_previous_posts_link( $args['next_text'] );
    2676                 $prev_link = get_next_posts_link( $args['prev_text'] );
     2679                $prev_link = get_next_posts_link( $args['prev_text'], $args['max_num_pages'] );
    26772680
    26782681                if ( $prev_link ) {
    26792682                        $navigation .= '<div class="nav-previous">' . $prev_link . '</div>';