This is the code I'm using to show recent posts from specific category on the homepage on my Wordpress website. But the issue I'm facing is that WP-pageNavi
plugin isn't working properly.
<div class="frontleft">
<div id="four-columns" class="grid-container" style="display:block;">
<?php $catquery = new WP_Query( 'cat=3&posts_per_page=24' ); ?>
<ul class="rig columns-4">
<?php while($catquery->have_posts()) : $catquery->the_post(); ?>
<li>
<a href="<?php the_permalink() ?>">
<?php the_post_thumbnail( 'single-post-thumbnail' ); ?>
</a>
<h3>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
</h3>
</li>
<?php endwhile; ?>
</ul>
</div>
<div class="navigation">
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
<?php } ?>
</div>
</div>
Note: I'm able to open mywebsite.com/page/2
without having any issue. But the post list is exactly same on each page.
How to fix it?
If I were you I would just use different Page Templates for homepage and other pages. It's hard to debug a plugin that we aren't using.
There is a function in Wordpress is_page() where you can input the name of the page in the para. Throwing that in an if statement is also another way to separate the posts.
There are a ton of ways to achieve what your looking for without the use of a plugin.