I'm using Presso theme, if I click on the numbers in homepage to go to page 2 for example, my url becomes page/2/ and the highlighted page number is 2 but the page keeps showing the posts of the page 1. Same story for any other page number, clicked from the homepage. The index.php is
<?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(); ?>
Digging in the teme, the pagination.php called by get_template_part is:
<?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; ?>
any help is highly appreciated
@
operator at@add_query_arg
is extremely bad practice, and doesn't do what you think it doesquery_posts
or doing something else to create a new post loop, but I see no evidence of that in the code you posted. What are you doing to manipulate or replace your query?$pagination['base']
? What kind of URLs are you trying to generate and why?