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.

I am using twentyten theme. I am trying to exclude category 1 from author posts. I used the following code in loop.php

query_posts(cat='-1');
while ( have_posts() ) : the_post(); ?>

But no post is displaying. How to fix this?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You've misplaced the apostrophe.

query_posts('cat=-1'); while ( have_posts() ) : the_post(); ?>
share|improve this answer
    
Thanks. Now the posts are displaying but all authors posts are displaying. –  designersvsoft Aug 16 '12 at 12:43
    
Yes, that is correct. Do you want to exclude some authors as well? Or show posts from only one author? –  pbd Aug 16 '12 at 13:13
    
If i click author A then the posts posted by him only display. Other authors posts should not display in author A's page. –  designersvsoft Aug 17 '12 at 4:47
    
Add the author parameter to your query, like this: query_posts('cat=-1&author=3'), where 3 is the author id. –  pbd Aug 17 '12 at 6:28
    
Thanks a lot. It's working. –  designersvsoft Aug 17 '12 at 6:59

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.