Title: Show All Category Posts
Last modified: August 21, 2016

---

# Show All Category Posts

 *  [tommyleyland](https://wordpress.org/support/users/tommyleyland/)
 * (@tommyleyland)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/show-all-category-posts/)
 * If you look here: [http://freelance.tstwebdesign.co.uk/news/](http://freelance.tstwebdesign.co.uk/news/)
   only one post is showing but I’m looking for all the posts in that category to
   show up.
 * The PHP I’m using:
 *     ```
       <?php if ( have_posts() ) : ?>
   
       			<?php /* The loop */ ?>
   
       			<?php while ( have_posts() ) : the_post(); ?>
       				<?php get_template_part( 'content', get_post_format() ); ?>
       			<?php endwhile; ?>
   
       			<div>
           <?php the_post_thumbnail( 'category-thumb' ); ?>
       		<div class="postdate"><?php the_date(); ?></div>
       		<div class="posttitle"><a href="<?php the_permalink() ?>"><h3><?php the_title(); ?></h3></a></div>
       		<?php the_excerpt(); ?>
       	</div>
   
       		<?php else : ?>
       			<?php get_template_part( 'content', 'none' ); ?>
       		<?php endif; ?>
       ```
   
 * Any help appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Kakoma](https://wordpress.org/support/users/kakomap/)
 * (@kakomap)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/show-all-category-posts/#post-4088683)
 * Hi,
    In which file is this code? You need to add: `query_posts('cat=x');` before`
   if ( have_posts() ) :` Replace ‘x’ with the category ID of the category you’d
   like to display
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/show-all-category-posts/#post-4088701)
 * > The PHP I’m using
 * is that category.php?
 * why is this section after the ‘endwhile’ of the loop?
 *     ```
       <div>
           <?php the_post_thumbnail( 'category-thumb' ); ?>
       		<div class="postdate"><?php the_date(); ?></div>
       		<div class="posttitle"><a href="<?php the_permalink() ?>"><h3><?php the_title(); ?></h3></a></div>
       		<?php the_excerpt(); ?>
       	</div>
       ```
   
 * does your theme have a _content.php_?
 * what are your settings under _**dashboard – settings – reading **_– _blog pages
   show at most …. posts?_
 * if you need to keep the setting there for any reason, do not add a query into
   category.php; consider using ‘pre_get_posts’ instead; [http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts)
 *  Thread Starter [tommyleyland](https://wordpress.org/support/users/tommyleyland/)
 * (@tommyleyland)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/show-all-category-posts/#post-4088795)
 * The code I use at the moment gets the correct category posts, it just only shows
   1 post for some reason. I would quite like to keep it like that instead of having
   to put in the category ID everytime I make a new category.
 * My page doesn’t have a content.php, what does that page do again?
 * > what are your settings under dashboard – settings – reading – blog pages show
   > at most …. posts?
 * Is says 10.
 * Thanks for your help.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/show-all-category-posts/#post-4088807)
 * > The PHP I’m using:
 * in what file is the posted code?
 * what is the full code of the template?
 * what happens if you temporarily switch to one of the default themes like Twenty
   Twelve?
 * what happens if you temporarily deactivate all plugins?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Show All Category Posts’ is closed to new replies.

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 4 replies
 * 3 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/show-all-category-posts/#post-4088807)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
