Support » Themes and Templates » listing posts belonging to category in single post

listing posts belonging to category in single post

  • Greetings,

    I have set up my wordpress site so that each page displays posts from a specific category. Each page would have a left column with the post titles belonging to that category. However, I would like it, when you click on a post, for that menu to remain. So it must be present in the single post page.

    Rather than write a bunch of if statements and wp_query’s i was wondering if anyone knew how I could make it so that other posts belonging to the same category as the single post were listed. There are over 5 categories, hence why I am looking for something simple. Preferably something that would work for both the page template and the single post template.

    thank you

Viewing 1 replies (of 1 total)
  • this is currently what i have

    foreach((get_the_category()) as $category) {
        echo $category->cat_ID . ' '; 
    <?php query_posts('cat=$category->cat_ID');
      						while (have_posts()) : the_post();
    				<a class="title" href="<?php the_permalink() ?>" rel="bookmark" title="Read the feature article: <?php the_title(); ?>"><?php the_title(); ?></a>
    			 <?php endwhile; ?>

    however, it is listing all post titles and in the single post view it is also aggregating all posts from the blog.

    lil help?

Viewing 1 replies (of 1 total)
  • The topic ‘listing posts belonging to category in single post’ is closed to new replies.