WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is going to be tough to explain. I have created a custom theme and have a file called: categories.php, in this file i have:

        $args = array('hide_empty' => FALSE);

This displays all my categories as links, even the ones without a post associated with them.

My permalink structure is this /%category%/%postname%/ so when i click a category name i go to http://example.com/category/action/. This is fine but what i'm struggling with is what file i have to create and what i have to put in said file so it displays all the posts from the clicked category?


share|improve this question
up vote 1 down vote accepted

if category.php does not exist, make a copy of archive.php or index.php and save it as category.php;

then, before the start of the loop, add:

<?php global $query_string; query_posts( $query_string . '&posts_per_page=-1'); ?>

share|improve this answer
Why the &posts_per_page=-1, what's the -1 about? – benhowdle89 May 14 '11 at 13:59
your question was for 'all posts' and -1 is the parameter to show all posts. codex.wordpress.org/Function_Reference/… codex.wordpress.org/Function_Reference/query_posts#Usage_Note – Michael May 14 '11 at 14:02

Your Answer


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.