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.

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:

    <?php
        $args = array('hide_empty' => FALSE);
        wp_list_categories($args);
    ?>

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?

Thanks

share|improve this question
add comment

1 Answer

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
1  
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
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.