Does your template file use a custom query?
Thread Starter
sebbri
(@sebbri)
This is the code for the index.php
<?php get_header() ?>
<div class="wrapper">
<div class="textarea">
<?php query_posts($y_string.'&cat=-1184'); ?>
<?php while( have_posts() ) : the_post() ?>
<h1 class="<?php post_class() ?>"><a>" title="Klicka här för att läsa inlägget"><?php the_title ()?></a></h1>
<div class="post-meta">Skrivet av <?php the_author() ?>, <?php the_date('d M') ?> <?php the_time() ?> i kategorin <?php the_category(); ?></div>
<div class="post">
<?php the_content('Läs vidare'); ?>
</div>
<?php endwhile; ?>
<?php rewind_posts(); ?>
<div class="navigation"><p><?php posts_nav_link(); ?></p></div>
</div>
<div class="side">
<?php get_sidebar('left'); ?>
<?php get_sidebar('right'); ?>
<?php get_sidebar('google'); ?>
<?php get_sidebar('box'); ?>
</div>
</div>
</div>
<?php get_footer() ?>
Try changing <?php query_posts($y_string.'&cat=-1184'); ?>
to:
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts($y_string.'&cat=-1184&paged=' . $paged); ?>
Thread Starter
sebbri
(@sebbri)
Thanks esmi, works like a charm!
How come my query didn’t work?
When you use query_posts, you completely over-write the standard post query and it’s pagination component. I simply added that pagination back into your custom query. The line translates to: if the WP_Query object contains a paged variable (only set for pages > 1), set the $paged variable to that value. Otherwise set $paged to 1 as we must be on the first page.