Trying to use pagination from a different query is always fraught with potential disaster. next_posts_link
accepts a second argument, $max_pages
, which may solve your issue if you pass it properly:
next_posts_link( __( 'Next'), $idxloop->max_num_pages );
However, the real answer to this question is to adjust your query before the template. Adjusting the default query via a new WP_Query
or by using query_posts
is quite simply doing it wrong, despite the millions of examples on the web you will see that do exactly that.
The preferred method for this is using a pre_get_posts
action along with a conditional check to apply it to the specific type of query you want to adjust:
function wpa64918_homepage_posts_per_page( $query ) {
if ( $query->is_home() && $query->is_main_query() )
$query->set( 'posts_per_page', 1 );
}
add_action( 'pre_get_posts', 'wpa64918_homepage_posts_per_page', 1 );