<?php query_posts('offset=1'); ?>
This is your problem. The pagination functions work off of the main query, but you replace the main query at the start of every page, and the only thing you’ve told it is that the offset is 1, how is it supposed to know you wanted page 2?!
So instead, I’m going to suggest a significantly improved way to do this. One that doesn’t double the number of database queries, pollute the main query, and is significantly faster:
The pre_get_posts
filter.
query_posts
does not modify the posts WP retrieves, WP still goes and fetches them. The function replaces the query, so lets modify the original query instead to fetch what we wanted, e.g.
function add_offset_to_query( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'offset', '1' );
}
}
add_action( 'pre_get_posts', 'add_offset_to_query' );
Keep in mind though that pagination relies on the offset
parameter, so this query will never truly work with pagination.
You also need to put this in functions.php
. WP uses the query to decide which template to load, so by the time the template is loaded the query has already ran.
A good rule of thumb is:
- Never use
query_posts
, pretend it doesn’t exist, there is no valid use, it brings only pain and headaches - If you need to change which posts WP fetches, use
pre_get_posts
- If you need to fetch some posts for a sub-section of a page, use a
WP_Query
loop get_posts
,get_pages
, etc etc all useWP_Query
, save some time and cut out the middle man, instead of learning lots of alternatives with weird quirks