WordPress.org

Ready to get started?Download WordPress

Forums

Not showing post in a particular category on home page (1 post)

  1. khaled
    Member
    Posted 7 years ago #

    Hey all, this shouldn't be too difficult but I'm having a bit of a dim moment right now and can't seem to be able to put 2 and 2 together. From my home page (www.brokenkode.com) I've structured the posts into two categories, the featured posts which come in the form of the following code:

    <?php $my_query = new WP_Query('category_name=featured&showposts=1');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID;?>

    <?php the_excerpt(); ?>
    <?php endwhile; ?>

    And the asides which are posted right below that:
    <?php if (have_posts()) : while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>

    <?php the_content('Continue reading this entry &raquo;'); ?>
    <?php endwhile; endif; ?>

    The problem (which I can't understand how I didn't think about before) is the fact that once I've posted another featured post then the older one will eventually show itself again in the second loop. Any ideas how to make sure that it's not shown in the second loop with the asides as it's currently being shown? Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic