• Hello, can someone say why archive page shows all posts but not specific to that category ?

    <?php get_header(); ?>
    
    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2 class="archiveTitle">Category: <strong><?php single_cat_title(); ?></strong></h2>
    
    <?php /* If this is a category archive */ } elseif (is_tag()) { ?>
    <h2 class="archiveTitle">Tag: <strong><?php single_tag_title(); ?></strong></h2>
    
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="archiveTitle">Month: <strong><?php the_time('F, Y'); ?></strong></h2> <?php } ?>
    
    <?php
    // Show a selected number of posts per row
    $posts_per_row = 4;
    $posts_per_page = 8;
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array(
       'posts_per_page' => $posts_per_page,
       'paged' => $paged,
    );
    query_posts($args);
    if (have_posts()) {
       while (have_posts()) {
          the_post();
          if ((++$post_counter % $posts_per_row) == 1  || $posts_per_row == 1) {
             if ($post_counter > 1) {
                echo "</div><!-- End of post_row -->\n";  // End previous row
             }
             echo "<div class='post_row'>\n";  // Start a new row
          }
          echo "<div class='post_class'>\n";  // Start one post
             // Output post data here
    		 ?>
        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Template <?php the_title_attribute(); ?>">
    	<?php if (strlen($post->post_title) > 40) {
    	echo substr(the_title($before = '', $after = '', FALSE), 0, 40) . '....'; } else {
    	the_title();
    	} ?>
    	</a></h2>
    		 <img src='images'></img>
    	<?php
          echo "</div><!-- End of post_class -->\n";  // End of post
       } ?>
       </div><!-- End of post_row -->
       <div style='clear:both;'></div>
    	<div id='pagenavi'>
    	<?php wp_pagenavi(); ?>
    	</div>
    <?php } else {
       // Code for no posts found
    }
    ?>
    <div style='clear:both;'></div>
    <?php get_footer(); ?>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Not working archive template’ is closed to new replies.