0

Here is my loop code for index.php . I do not have an archive or category.php right now. This is very basic.

$temp = $wp_query;
global $wp_query;    
$wp_query = new WP_Query();

$wp_query->query('posts_per_page=20'.'&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post();

I have about 10 posts split up into different categories.

When I click /category/category-name it just lists all posts rather than filtering by category.

Can someone help me out if they know the solution?

Thanks.

2

You are overwriting the query that loads with the page (which you saved to $temp) - why not just use the one that loads with the page:

while(have_posts()) : the_post();

// put the post here

endwhile;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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