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 have create a category by using Custom Post Type plugin, and now only the 5 most recent posts of the category are showing.
What I want is to show all posts for the category.
For examle, suppose I have movies category - I want all movies in that category.
What code should I use and where?
I don't know much about the wordpress, so I would appreciate a step by step process.

share|improve this question
add comment

migrated from stackoverflow.com May 17 '11 at 16:53

This question came from our site for professional and enthusiast programmers.

3 Answers

   <?php
    $args = array( 'category' => 7, 'post_type' =>  'post' ); 
    $postslist = get_posts( $args );    
    foreach ($postslist as $post) :  setup_postdata($post); 
    ?>  
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> 
    <?php the_excerpt(); ?>  
    <?php endforeach; ?> 

just change the category id (number 7) and change the post_type that was in the plugin

to learn more about post_type, see link http://codex.wordpress.org/Custom_Post_Types

share|improve this answer
add comment

It is quite easy to do it with wordpress. You have to understand that post are normally display within a "loop", a small code that repeat itself. You have to use one to do that.

<?php 
 $catPost = get_posts(get_cat_ID("NameOfTheCategory")); //change this
   foreach ($catPost as $post) : setup_postdata($post); ?>
       <div>
             <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> 
             <p><?php the_content(); ?></p>
       </div>
<?php  endforeach;?>

You should change the output to what fit your needs

share|improve this answer
add comment

I have written an article How To List All Posts Of An Archive … with the basic code for this very task.
In short: set the parameter 'nopaging' for your query to TRUE.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.