Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Really rusty on the wordpress front.

I am using custom permalinks /%category%/%postname%/ as well as the WP No Category Base plugin, so my urls look like this: http://www.url.com/parent_category/child_category/

I only have an index.php set up at the moment, with the most basic loop possible:

<?php if (have_posts()) : ?>

<?php query_posts(); ?>
<?php while (have_posts()) : the_post(); ?>    

<div class="post">
   <?php the_title(); ?>
   <br />
   <?php the_content(); ?>
</div>

<?php endwhile; ?>    
<?php else: ?>   
<?php endif;?>  

The problem is, all posts are coming through, instead of just the posts in the category represented by the url. I didn't think I needed a custom query, because the link that took me to the particular url should have been carried across. What am I missing?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The <?php query_posts(); ?> in your code is causing the global query to be reset to show all posts instead of the one set by your rewrite rules. You should remove that line.

share|improve this answer
    
Oh god, embarrassing. Thanks! –  danixd Feb 2 '11 at 9:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.