L
L
Lin69x2017-05-18 16:53:48
WordPress
Lin69x, 2017-05-18 16:53:48

Ajax pagination duplicates posts on the main page, but it works correctly on all other pages, what is the reason?

I output an arbitrary type of posts using the query_posts() method. I
connect ajax pagination at the bottom, everything works both on static pages and in archives.
And on the main page it loads exactly the same records. Please tell me how can I fix it.
Code:
$args = array( 'post_type' => 'custom-type', 'posts_per_page' => 8, 'order' => 'DESC', 'page' => get_query_var('paged'), );
query_posts($args);
while ( have_posts() ) : the_post();

get_template_part( 'content-reading', get_post_format() );

endwhile;
echo ''; echo next_posts_link(__('Show more')); echo '';
wp_reset_query();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question