Restrict Aside Posts
-
I used the hack to add asides to my sidebar
the code I am using is as follows:
<?php rewind_posts(); ?>
<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
<?php if (in_category(6)) { ?>
<div class="botw"><h5>Band of the Week</h5>
<?php echo $post->post_excerpt ?> <?php the_content(); ?>
<small><p class="postmetadata"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
</small>
</div>
<?php } ?>
<?php if (in_category(7)) { ?>
<div class="cotw"><h5>Clown of the Week</h5>
<?php echo $post->post_excerpt ?> <?php the_content(); ?>
<small><p class="postmetadata"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
</small>
</div>
<?php } ?>
Basically I want to have two categories shown in the sidebar however I only want the most recent post from each one to be displayed.. as it is..the sidebar displays all of the posts in that category.
I tried changing
foreach ($posts as $post)to a standard for loop which only iterates twice however that only gives me the right look if those two aside posts are my most recent in the whole siteany ideas on how to fix this up??
The topic ‘Restrict Aside Posts’ is closed to new replies.