我使用的是Presso主题,例如,如果我单击主页中的数字转到第2页,我的url将变为第/2页,突出显示的页码为2,但页面会一直显示第1页的帖子。从主页上单击,任何其他页码的情况都相同。索引。php是
<?php get_header(); ?>
<div id="page-wrapper" class="container">
<?php echo do_shortcode( vw_get_option( \'header_ads_code\' ) ) ; ?>
<div class="row">
<div id="page-content" class="col-sm-7 col-md-8">
<?php $the_query = new WP_Query( \'cat=-7,-3\' ); ?>
<?php if ($the_query->have_posts()) : ?>
<?php get_template_part( \'templates/page-title\' ); ?>
<?php $blog_layout = vw_get_option( \'blog_layout\' ); ?>
<?php if ( \'classic\' == $blog_layout ) : ?>
<div class="row archive-posts post-box-list">
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<div class="col-sm-12 post-box-wrapper">
<?php get_template_part( \'templates/post-box/classic\', get_post_format() ); ?>
</div>
<?php
endwhile;
?>
</div>
<?php else: ?>
<div class="row archive-posts vw-isotope post-box-list">
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<div class="col-sm-6 post-box-wrapper">
<?php get_template_part( \'templates/post-box/large-thumbnail\', get_post_format() ); ?>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
<?php get_template_part( \'templates/pagination\' ); ?>
<?php comments_template(); ?>
<?php else : ?>
<h2><?php _e(\'Sorry, no posts were found\', \'envirra\') ?></h2>
<?php endif; ?>
</div>
<aside id="page-sidebar" class="sidebar-wrapper col-sm-5 col-md-4">
<?php get_sidebar(); ?>
</aside>
</div>
</div>
<?php get_footer(); ?>
挖掘主题,分页。get\\u template\\u part调用的php是:<?php global $wp_query, $wp_rewrite; ?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<div id="pagination" class="header-font clearfix">
<?php
$wp_query->query_vars[\'paged\'] > 1 ? $current = $wp_query->query_vars[\'paged\'] : $current = 1;
$pagination = array(
\'base\' => @add_query_arg( \'paged\',\'%#%\' ),
\'format\' => \'\',
\'total\' => $wp_query->max_num_pages,
\'current\' => $current,
\'prev_text\' => __( \'«\', \'envirra\' ),
\'next_text\' => __( \'»\', \'envirra\' ),
\'type\' => \'plain\'
);
if( $wp_rewrite->using_permalinks() )
$pagination[\'base\'] = user_trailingslashit( trailingslashit( remove_query_arg( \'s\', get_pagenum_link( 1 ) ) ) . \'page/%#%/\', \'paged\' );
if( !empty( $wp_query->query_vars[\'s\'] ) )
$pagination[\'add_args\'] = array( \'s\' => urlencode( get_query_var( \'s\' ) ) );
// echo \'<span>\' . sprintf( __( \'Page %s of %s\', \'envirra\' ), $current, $wp_query->max_num_pages ) . \'</span>\'.\' \';
echo paginate_links( $pagination );
if ( false ) posts_nav_link();
?>
</div>
<?php endif; ?>
非常感谢您的帮助