Recent Posts
-
On my blog i have it where it checked to see which category you’re in and lists posts from that category under Recent Posts.
<li><h2>
<?php
if ((!is_home()) & (!in_category(8)) & (!in_category(1))) {
_e('Recently Answered'); ?></h2><ul>
<?php $categoryvariable=$cat; // assign the variable as current category
$query= 'showposts=5&cat=' . $categoryvariable. '&orderby=date&order=ASC'; // concatenate the query
query_posts($query); // run the query
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?><li><a>"><?php the_title() ?> </a> </li>
<?php endwhile; endif; ?>
</ul>
</li>
<?php } ?>The conditions I’m trying to make are that if you’re not on your home page in categories 8 or 1, display Recently Posted Posts From the category you are viewing. But when I select a specific post ie.
http://**/wordpress/?p=9it displays new posts from every category. It only does this on specific posts pages. How can I fix this?PS: How the heck do you use the Markup to format code on this bloody forum?
The topic ‘Recent Posts’ is closed to new replies.