How to show all posts of the category in wordpress?

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.

Related posts

Leave a Reply

4 comments

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

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

  3. You can use this code for accessing all post of specific category. In your category.php page use the spinet of code

    $current_category = get_queried_object(); ////getting current category
    $args = array(
            'post_type' => 'our-services',// your post type,
            'orderby' => 'post_date',
            'order' => 'DESC',
            'cat' => $current_category->cat_ID // current category ID
    );
    $the_query = new WP_Query($args);
    if($the_query->have_posts()):
       while($the_query->have_posts()): $the_query->the_post();
        echo "<h2>".the_title()."</h2>";
        echo "<p>".the_content()."</p>";
    endwhile;
    endif;
    
  4. This is adapted from code someone else wrote, and which I benefitted from too long ago to know where it came from (if the person who originally wrote it is reading this, thanks again). It works for your request:

    <?php
    $catPost = get_posts('cat=888&posts_per_page=-1000');
       foreach ($catPost as $post) : setup_postdata($post); ?>
      <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
        <?php the_post_thumbnail('name of your thumbnail'); ?>
      </a>
    
    <h4>
      <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
        <?php the_title(); ?>
      </a>
    </h4>
    <hr/ style="clear:both;">
    <?php  endforeach;?>