WordPress.org

Make WordPress Core

Ticket #28405: 28405.patch

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

     
    1414 * @since Twenty Fourteen 1.0
    1515 */
    1616function twentyfourteen_paging_nav() {
     17        global $wp_query, $wp_rewrite;
     18
    1719        // Don't print empty markup if there's only one page.
    18         if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
     20        if ( $wp_query->max_num_pages < 2 ) {
    1921                return;
    2022        }
    2123
     
    3133        $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
    3234        $pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
    3335
    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=%#%';
     36        $format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
     37        $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
    3638
    3739        // Set up paginated links.
    3840        $links = paginate_links( array(
    3941                'base'     => $pagenum_link,
    4042                'format'   => $format,
    41                 'total'    => $GLOBALS['wp_query']->max_num_pages,
     43                'total'    => $wp_query->max_num_pages,
    4244                'current'  => $paged,
    4345                'mid_size' => 1,
    4446                'add_args' => array_map( 'urlencode', $query_args ),