Firstly, avoid query_posts
, instead use WP_Query or hook into pre_get_posts
. query_posts
is bad practice, a performance hit/slowdown, and a source of many troubles. As a fulltime developer I wouldn’t very strongly recommend against all use of that function, and many prominent WordPress developers and WordPress Core devs would say and do say the same.
The reason your code doesn’t work is because query_posts
redoes the query, wasting the main query, and removing all the pagination query vars included.
Instead use the pre_get_posts
filter to modify the homepage, e.g. to change the number of posts on the homepage:
function hwl_home_pagesize( $query ) {
if ( is_home() && is_main_query()) {
//Display only 1 post for the original blog archive
$query->query_vars['posts_per_page'] = 1;
return;
}
}
add_action('pre_get_posts', 'hwl_home_pagesize', 1);
http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts