Support » Themes and Templates » 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)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Category Template Loop’ is closed to new replies.