I edited my wordpress page to only display posts from certain categories. This works, but if I want to view previous entries it just shows the same.
This is the blog: http://www.medusaphotography.be/blog/
This is the 'previous entries' page: http://www.medusaphotography.be/blog/?paged=2
As you can see, the posts are exactly the same.
This is my code:
...
<?php query_posts('cat=-1');?>
<?php if (have_posts()) : ?>
<?php while (have_posts() ) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
...
It's just a basic Wordpress loop with query_posts('cat=-1'); in front of it. If I remove this line, the previous entries work, but obviously the posts of category 1 still get displayed.
What am I doing wrong?
At the moment your query post overwrites the existing query, and just removes category 1. You want to take the original query and modify it.
The following code will do the job:
global $query_string;
query_posts( $query_string . '&cat=-1' );
Query string holds whatever variables would of defaulted for the page / post / category you are on. You can see what it contains by using print_r()