the recommended code for the 1st line of your code is this
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
Not sure it will make a difference in combination with offset but its worth trying.
Thanks for the advice, but doesn’t work…
Indeed it does not make any difference wether you use:
$page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
or:
$page = get_query_var(‘paged’);
Any other ideas?
Are you adding ‘&paged=’ when you load the next page’s url? If not, try it.
I generate the URLs via the function posts_nav_link()…
Not sure what you mean, but I dont think thats the problem, coz I got no problem if I do not use the offset parameter. So I dont think the problem has something to do with &paged not being loaded…
If I add something like ‘offset’ => ‘1’ the ‘paged’ parameter has no effect anymore…
Does anyone know a workaround?
pagination simply does not work with ‘offset’ at the same time;
if the ‘offset’ is used to avoid the first post to be shown twice, look into the methods of avoiding duplicate posts:
http://codex.ww.wp.xz.cn/The_Loop#Multiple_Loops_in_Action
Hm, does not solve my actual problem, but thanks for the link!
The technique used @multiple Loops in Action brought me to a solution I tested and which worked…
Is there any special reason why ‘offset’ and pagination doesnt work togehter?
@skidevil can you post the solution you came up with?
Thanks!!!
Sure,
I wanted to achieve that the first post of each site is displayed different (bigger thumbnail, other font, etc.)
I did this using two queries. The first query does not makes any trouble at all. First I thought I could use offset and pagination for the second post, but that doesnt work. Instead you use something like:
<?php $my_query = new WP_Query('category_name=featured&posts_per_page=1');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID; ?>
<!-- Do stuff... -->
<?php endwhile; ?>
and
<?php if (have_posts()) : while (have_posts()) : the_post();
if( $post->ID == $do_not_duplicate ) continue;?>
<!-- Do stuff... -->
<?php endwhile; endif; ?>
For explanation read:
http://codex.ww.wp.xz.cn/The_Loop#Multiple_Loops_in_Action