无法在其他语言(RU和IT)上进行分页

时间:2019-01-16 16:56:34

标签: wordpress pagination multilingual

在搜索分页时,可以使用EN语言很好地工作,但是不能用于RU和IT。我不确定在代码中哪里可以找到此问题以及如何解决该问题。 我做的事: 按主页上的“搜索”,然后按第二页或结果。 如果有人知道问题出在哪里,请告诉我

  if ( ! function_exists( 'theme_pagination' ) ) {
function theme_pagination( $pages = '' ) {
    global $paged;

    if ( is_page_template( 'templates/home.php' ) ) {
        $paged = intval( get_query_var( 'page' ) );
    }

    if ( empty( $paged ) ) {
        $paged = 1;
    }

    $prev       = $paged - 1;
    $next       = $paged + 1;
    $range      = 3; // only change it to show more links
    $show_items = ( $range * 2 ) + 1;

    if ( $pages == '' ) {
        global $wp_query;
        $pages = $wp_query->max_num_pages;
        if ( ! $pages ) {
            $pages = 1;
        }
    }

    if ( 1 != $pages ) {
        echo "<div class='pagination'>";
        echo ( $paged > 2 && $paged > $range + 1 && $show_items < $pages ) ? "<a href='" . get_pagenum_link( 1 ) . "' class='real-btn'>&laquo; " . __( 'First', 'framework' ) . "</a> " : "";
        echo ( $paged > 1 && $show_items < $pages ) ? "<a href='" . get_pagenum_link( $prev ) . "' class='real-btn' >&laquo; " . __( 'Previous', 'framework' ) . "</a> " : "";

        for ( $i = 1; $i <= $pages; $i ++ ) {
            if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $show_items ) ) {
                echo ( $paged == $i ) ? "<a href='" . get_pagenum_link( $i ) . "' class='real-btn current' >" . $i . "</a> " : "<a href='" . get_pagenum_link( $i ) . "' class='real-btn'>" . $i . "</a> ";
            }
        }

        echo ( $paged < $pages && $show_items < $pages ) ? "<a href='" . get_pagenum_link( $next ) . "' class='real-btn' >" . __( 'Next', 'framework' ) . " &raquo;</a> " : "";
        echo ( $paged < $pages - 1 && $paged + $range - 1 < $pages && $show_items < $pages ) ? "<a href='" . get_pagenum_link( $pages ) . "' class='real-btn' >" . __( 'Last', 'framework' ) . " &raquo;</a> " : "";
        echo "</div>";
    }
}
}

0 个答案:

没有答案