Single Post template shows other posts from same category
There are a few questions floating around about this, but none of them seem to have any definitive answers, so I’ll try one more time.
I’m trying to put other posts from the same category below the post on my single post page (you can see a good example at defamer.com). Here’s the code I’ve got so far (directly after and outside of the loop):
<?php $cat = get_the_category(); ?>
<?php $cat = trim($cat->cat_name); ?>
<?php query_posts('category_name="$cat"&showposts=15'); ?>
<?php while (have_posts()) : the_post(); ?>
blah blah blah
<?php endwhile; ?>
Not only does this not work (no output at all), but I’m worried that even if I do get it to work, it will query even the post that I already have showing at the top of the page, to make sure that wp doesn’t also show it down below. Any ideas on this?
- The topic ‘Single Post template shows other posts from same category’ is closed to new replies.