Why the navigation does not work in WP_query?

Dear experts. There is a page that in the admin panel appointed glavnoy. In the template loop to output the posts. And it's not working navigation. What's wrong?
<?php
 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
 $args = array(
 'post_type' =--> 'post',
 'posts_per_page' => '1',
 'paged' => $paged,

);
 $wp_query = new WP_Query( $args );

 if ( have_posts() ) :

 while ($wp_query->have_posts()) : $wp_query->the_post(); 

 get_template_part( 'template-parts/content', get_post_format() );

endwhile;

the_posts_navigation();

 else :

 get_template_part( 'template-parts/content', 'none' );

 endif; 
 wp_reset_postdata(); ?>


UPD: If this bit is not assigned as a home.. the loop works fine. But I need this page was the main
July 12th 19 at 17:18
2 answers
July 12th 19 at 17:20
It is possible that something interrupts a valid request to the_posts_navigation();

Try to use a third-party plugin WP-PageNavi
https://wordpress.org/plugins/wp-pagenavi/

and use this template
wp_pagenavi( array( 'query' => $wp_query ) );
instead
the_posts_navigation();
did not help - Avis_Stoltenberg10 commented on July 12th 19 at 17:23

> Also not working - Avis_Stoltenberg10 commented on July 12th 19 at 17:26
you have definitely enters the if ( have_posts() ) ???
Try to put after the if ( have_posts() ) echo '123';
Displays 123? - Isabelle_Feest56 commented on July 12th 19 at 17:29
Yeah, displays.. and there I addition to the question added that if the page is not set as the main static, the navigation works.. but if I put her in settings like home, it turns out such garbage. - Avis_Stoltenberg10 commented on July 12th 19 at 17:32
July 12th 19 at 17:22
global $wp_query;
instead
wp_reset_postdata();
wp_reset_query() ;
did not help - Avis_Stoltenberg10 commented on July 12th 19 at 17:25
: try to set posts_per_page set to 2 - Avis_Stoltenberg10 commented on July 12th 19 at 17:28
: well put wp_reset_query(); before the_posts_navigation(); - Isabelle_Feest56 commented on July 12th 19 at 17:31

Find more questions by tags WordPressPHP