Static Page Paging is not working

1

The last posts and the link paging are appearing, but when I click the link , the URL changes to /page/2/ but stays with the same content on the first page .

Does anyone know how I can resolve?

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array( 'post_type' => 'post', 'posts_per_page' => 8, 'paged' => $paged );
    $wp_query = new WP_Query($args);
    while ( have_posts() ) : the_post(); ?>
      <div class="noticia-index">
            <a href="<?php the_permalink(); ?>"><div class="post-thumbnail">
            <?php the_post_thumbnail(); ?>
            </div></a>
            <div class="noticia-index-conteudo"><a href="<?php the_permalink(); ?>"><h2 class="noticia-titulo"><?php the_title(); ?></h2></a>
            <div class="subtitulo-noticia"><?php the_excerpt(); ?></div>
            <span class="icone-time"><img src="<?php echo get_stylesheet_directory_uri(); ?>/img/icones/time-icon.png"></span>
            <span class="time"><?php the_time(); ?></span>
            <span class="icone-comment"><img src="<?php echo get_stylesheet_directory_uri(); ?>/img/comment.png"></span>
            <span class="comments">1</span>
            <a class="leia-mais" href="<?php the_permalink(); ?> ">Leia mais...</a>
        </div>
    </div>
			
<?php endwhile; ?>

<!--  Links de paginação -->
<?php next_posts_link( '&larr; Older posts', $wp_query ->max_num_pages); ?>
<?php previous_posts_link( 'Newer posts &rarr;' ); ?>
    
asked by anonymous 21.01.2017 / 20:44

1 answer

0

I was able to solve in a very simple way, just change the parameters of the first line to 'page' instead of 'paged'

(get_query_var('page')) ? get_query_var('page') : 1;

This link talks more about it

link

    
22.01.2017 / 16:46