WordPress Homepage Pagination Problem with WP-PageNavi

I ran into quite an odd problem in WordPress. The homepage pagination would work on all pages except for the homepage. A simple search for WordPress homepage pagination problem did result in multiple hits, but all having the same problem. Luckily I was able to solve it for me.

I do have a general guide at: https://schurpf.com//custom-query-pagination-custom-post-type-pagination/ This should solve almost all pagination problems except for the homepage pagination problem.

In my case, the problem was only the pagination on the homepage. The solution was rather simple. The pagination variable on the homepage changes from:

$paged

to

$page

So all you have to do is assign

$paged = $page;

before the query_post function and loop. The entire pagination code changes to:

<?php $paged = $page;
$args= array(
'paged' => $paged
);?>
<?php query_posts( $args );?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

...

Note that you have to set

$paged = $page;

at the top to ensure WP-PageNavi is working correctly. Hopefully this solves all your WordPress homepage pagination problems!

The ideal day to resolve soundness problem is before any visible sign appears. Actually there isn’t anything you can’t purchase on the Internet anymore. Whereas erectile disfunction is more common among older men, that doesn’t something you simply have to live with. What about “canadian pharmacy cialis 5 mg” and “cialis canadian pharmacy“? In our generation, there are divers options for those ones who suffer from erectile disfunction. You may have heard about “canadian pharmacy online cialis“. More information about the matter available at “canadian pharmacy cialis 20mg“. Why it happen? Can sexual disorders in men be prevented? If you get any prescription remedies like Viagra, check with a pharmacist that they are sure to take with your other remedies.

The Top 8 WordPress Developer Tools from 5 years experience
(Hint: They cut down my development time in less than half!)

Get the Top Tools Now!

Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.