• Hi,

    I would like to add a second loop to a catagory page template that shows posts from another catagory.

    For example, if you had a ‘News’ catagory page listing all recent posts from that catagory, then down the right side of the page I would also like to have a loop displaying posts from a ‘Featured Article’ catagory.

    I have tried before using the following code which works for creating 2 or more loops on the index page but doesn’t seem to work on any other template page:

    (Code placed in addition to existing catagory loop code)

    <?php global $query_string;
    $posts = query_posts($query_string.'&posts_per_page=6&cat=6');
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    		<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
    
    <?php
      $excerpt = get_the_excerpt();
      echo string_limit_words($excerpt,12);
    	echo " ...";
    ?>
    
    <?php endwhile; ?>
    
    <?php endif; ?>
    
    <?php wp_reset_query();
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add another Loop to catagory page’ is closed to new replies.