WordPress.org

Support

Support » How-To and Troubleshooting » Not showing post in a particular category on home page

Not showing post in a particular category on home page

  • 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.

  • The topic ‘Not showing post in a particular category on home page’ is closed to new replies.
Skip to toolbar