“The problem I have it that on the first 8 pages only 1 article is displayed.”
That would be due to this line of code:
if ( $wp_query->get( 'paged') < 8 ) {
$wp_query->set( 'posts_per_page', 1);
}
See here for more info: codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters
EDIT:
Try adding brackets as mentioned by @kaiser… Here’s your original code you posted in pastebin with brackets/indentions added where I think they’re supposed to go…
function wpse31701_filter_query() {
global $wp_query;
// Check year and month
$wp_query->set('orderby', 'date'); $wp_query->set('order', 'ASC');
if ( $wp_query->get( 'year' ) == 2005 and $wp_query->get( 'monthnum' ) == 4 ) {
// Check page number to apply offset
if ( $wp_query->get( 'paged') == 2 ) {
$wp_query->set( 'offset', 1 );
}
else {
if ( $wp_query->get( 'paged') == 3 ) {
$wp_query->set( 'offset', 4 );
}
else {
$wp_query->set( 'posts_per_page', 1);
}
}
}
}
add_action( 'pre_get_posts', 'wpse31701_filter_query' );
Your first “if” statement had no brackets around what it was supposed to evaluate. If you code conditionals without brackets, then it’s only going to evaluate the first line following it. If there’s more than one line in the evaluation, you need to either use brackets or colons.
Now, I’m not sure if this is going to fix your problem… but it’s at least a very good idea to properly format the code first before trying to debug any “problems”, as the formatting very well may be one of, if not “the” problem.