WordPress.org

Make WordPress Core

Ticket #28405: 28405.2.patch

File 28405.2.patch, 1.7 KB (added by SergeyBiryukov, 7 years ago)
  • src/wp-content/themes/twentyfourteen/inc/template-tags.php

     
    1212 * Display navigation to next/previous set of posts when applicable.
    1313 *
    1414 * @since Twenty Fourteen 1.0
     15 *
     16 * @global WP_Query   $wp_query   WordPress Query object.
     17 * @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
    1518 */
    1619function twentyfourteen_paging_nav() {
     20        global $wp_query, $wp_rewrite;
     21
    1722        // Don't print empty markup if there's only one page.
    18         if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
     23        if ( $wp_query->max_num_pages < 2 ) {
    1924                return;
    2025        }
    2126
     
    3136        $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
    3237        $pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
    3338
    34         $format  = $GLOBALS['wp_rewrite']->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
    35         $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%';
     39        $format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
     40        $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
    3641
    3742        // Set up paginated links.
    3843        $links = paginate_links( array(
    3944                'base'     => $pagenum_link,
    4045                'format'   => $format,
    41                 'total'    => $GLOBALS['wp_query']->max_num_pages,
     46                'total'    => $wp_query->max_num_pages,
    4247                'current'  => $paged,
    4348                'mid_size' => 1,
    4449                'add_args' => array_map( 'urlencode', $query_args ),