Title: Category Template Loop
Last modified: November 30, 2016

---

# Category Template Loop

 *  [roadstardesign](https://wordpress.org/support/users/roadstardesign/)
 * (@roadstardesign)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/category-template-loop/)
 * Hi there! I’m trying to build a category template page for a category with an
   ID of 1229. Here’s my code, which despite the argument is still pulling posts
   from ALL categories. What am I missing? Thanks very much for your time and here’s
   the code:
 *     ```
       <?php 
       /*
       Template Name:Category-for-photographers Template
       */
       get_header(); ?>
       <div class="content">
       	<div class="container">
        		<div class="myblog">
        			<?php 
        			$paged=(get_query_var('paged')) ? (get_query_var('paged')) :1;
        			$args = array('post_type' => 'post','posts_per_page' => '6','paged' => $paged, 'category' => '1229'); 
        			query_posts($args); 
       			if (have_posts()): ?>  
         		<?php while(have_posts()): the_post();  ?>
        				<div class="col-lg-4 col-md-4 col-sm-6">
        					<div class="box">
       						<a href="<?php the_permalink(); ?>"> <?php if(has_post_thumbnail()) { the_post_thumbnail('blog-thumb', array( 'class' => 'img' )); } ?> </a>
        					</div>
       					<div class="blog-index-post-title"><p><?php the_title(); ?></p></div>
        				</div>
         		<?php endwhile; ?>
   
        			<div class="paginat">
       				<div class=" col-xs-6 text-left"><?php previous_posts_link( '< Newer posts' ); ?> <!--<a href="<?php previous_posts_link(); ?>">< Next POSTS</a> --></div>
       				<div  class=" col-xs-6 text-right"><?php next_posts_link( 'Older posts >' ); ?><!--<a href="<?php next_posts_link(); ?>" >< OLDER POSTS</a> --></div>
   
        			</div>
        			<?php endif; wp_reset_query();?>
        		</div>
        	</div>
       </div>
        <?php get_footer(); ?>
       ```
   

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/category-template-loop/#post-8496180)
 * [https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters](https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters)
 *  Thread Starter [roadstardesign](https://wordpress.org/support/users/roadstardesign/)
 * (@roadstardesign)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/category-template-loop/#post-8496333)
 * Ah! Thanks for the link. Issue fixed.

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

The topic ‘Category Template Loop’ is closed to new replies.

## Tags

 * [category id](https://wordpress.org/support/topic-tag/category-id/)
 * [the-loop](https://wordpress.org/support/topic-tag/the-loop/)

 * 2 replies
 * 2 participants
 * Last reply from: [roadstardesign](https://wordpress.org/support/users/roadstardesign/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/category-template-loop/#post-8496333)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
