i'm using a query-loop on my template pages like this:
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$wp_query = new WP_Query();
$wp_query->query('posts_per_page='.get_option('posts_per_page').'&paged=' . $paged);
global $wp_query;
query_posts(array_merge($wp_query->query, array(
'paged' => get_query_var('paged'),
'posts_per_page' => 2
)));
?>
<?php if ($wp_query->have_posts()) : ?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div class="portfolioitem">
<a href="<?php the_permalink() ?>">
<?php the_post_thumbnail( 'portfolioteaser' ); ?>
<div class="mask">
<h2><?php the_title(); ?></h2>
</div>
</a>
</div>
<?php endwhile; ?>
<?php endif; ?>
the pagination works fine with this except on the category.php or tag.php. The first page is showing correctly but for example if i click on "category/categoryname/page/2" it shows no content anymore an dthe pagination disappears...
i know it must be something wrong with the query loop...
help would be nice! thanks alot, Jochen
query_posts()
? That's your problem. The fix is to get rid ofquery_posts()
.$query
properly. If you need/want to do more than just changeposts_per_page
, please update your question to indicate your needed changes.