I'm aware this is a topic discussed to death, but I have read through many solutions and can't understand why my pagination simply isn't working.
I have a very simple custom wp_query:
$current_page = (get_query_var('paged')) ? get_query_var('paged') : 1; $project_query = new WP_query(array( 'post_type' => 'project', 'paged' => $current_page, 'posts_per_page' => 50 ));
There are about
2000 projects in there, so without a doubt, there are pages.
This is on my
index.php of the theme.
No matter what, the URL
/p/pageno returns a 404. The function
next_posts_link('Older Entries »', $project_query->max_num_pages); is always empty.
I have tried, based on reading several similar questions:
- Setting reading settings to display 1 post max at a time, to ensure pagination kicks in.
- Installing wp_pagenavi - same result
- Setting the homepage to a static page with this code in a custom page template - this finally works somewhat (
/p/2etc don't 404), but then
next_posts_link()stops at page 2 and goes no further.
get_query_var('page')in the custom page template
I'm at a loss, this should be so simple, but pagination always seems to be the one thing that kills me when working with Wordpress.