Show all posts in post category AND just the post
-
On single.php I have all post titles for the post’s category showing on the sidebar. That’s good. But where the content of the post is suppossed to show, I get the content for every post in that posts’s category. Not good.
So if this is in the sidebar and getting called first
<?php
$categoryvariable=$cat; // assign the variable as current category
$query= 'cat=' . $categoryvariable; // concatenate the query
query_posts($query); // run the query
?>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>Then how can I get just the post to show in the second Loop call of
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="contentheading"><?php the_title(); ?></div>
<hr class="c">
</p>
<?php the_content(); ?>If I have the sidebar load last, as in on the right side instead of left, it works. But I want the sidebar on the left.
- The topic ‘Show all posts in post category AND just the post’ is closed to new replies.