Pagination (on the static front page) shows always the same posts

I have a problem with pagination on my front page.
I want to show all posts from a specific category and paginate them.
Here is the code

<?php
if (is_front_page()) {
$paged = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1;
$args = array(
‘post_type’ => ‘post’ ,
‘orderby’ => ‘date’ ,
‘order’ => ‘DESC’ ,
‘posts_per_page’ => 1,
‘cat’ => ‘4’,
‘page’ => $paged
);
$q = new WP_Query($args);
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post();?>
<div> …. </div>
}
//pagination links
wp_reset_query();
}
}

But all the time I have the same posts on different pages: domain.com/page/2/ etc.
What I’m doing wrong?
How to fix it?

Thank you for any help.

Read more here:: Pagination (on the static front page) shows always the same posts

Leave a Reply

Your email address will not be published. Required fields are marked *