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.

When I go to a tag archive ( http://themeforward.com/demo2/tag/n/ for example) ALL the posts on my blog are being displayed, not just the posts with that tag - and I'd like to fix this.

Here's my tag map, click any tag and ALL posts are being pulled http://themeforward.com/demo2/templates/547-2/

Here is how I am querying posts (there is custom code for an options panel to display the number of posts assigned):

<?php
$per_page = get_option('to_count_archives');
query_posts("cat=${cat}&posts_per_page=${per_page}&paged=".$paged);
if (have_posts())
?>
<?php while (have_posts()) : the_post(); ?>
share|improve this question
1  
Whenever you set the query arguments for any type of archive(or view) unless you're merging them you're essentially re-defining that type of query. There's no merging in your code, and you've not specified which file the code you have posted is in, but it's a distinct possibility you could be alterating all kinds of queries(but that's impossible to know without details of where your above code is). –  t31os Dec 14 '11 at 15:17
add comment

1 Answer

up vote 1 down vote accepted

create a tag.php template from a copy of archive.php or category.php, and remove the 'query_posts' line from the code.

share|improve this answer
    
Would there be any reason NOT to remove query_posts from my index.php and archive.php also? –  AndrettiMilas Dec 14 '11 at 14:50
    
I don't know the reason why query_posts is in these templates, so I can't comment on your question. you can always make a backup copy of your theme first, and then try to remove it. –  Michael Dec 14 '11 at 16:50
add comment

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.