I am trying to set up a category archive (editing category.php) that displays a list of posts from one single category. If I left the twentyten default code
(get_template_part( 'loop', 'category' );)
and i go to www.mysite.com/categoryname it correctly filters the posts only for the categoryname.
If I try to use my custom query code, going to www.mysite.com/categoryname every post is displayed, despite of category. This is the loop code:
<?php if (have_posts()) : ?>
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 5,
'orderby' => comment_count,
);
query_posts($args);
while (have_posts()) : the_post();?>
MY CUSTOM CONTENT
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
thanks
That happens because you are overwriting the query with you $args, If you want to modify it and not overwrite it then use this format: