Support » Plugins » 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 site

    any ideas on how to fix this up??

Viewing 3 replies - 1 through 3 (of 3 total)
  • bump >:P

    in essence what i want to do is limit the two aside category posts in my sidebar to dislpaying 1 post each

    have a look here if it helps

    bump >:P

    <?php rewind_posts(); ?>
    <?php $notDone=true?>
    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    <?php if (in_category(6) && $notDone) { ?>
    <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 $notDone=false ?>
    <?php } ?>
    <?php endforeach; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    theres my solution…if anyone cares

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Restrict Aside Posts’ is closed to new replies.