[resolved] can a single post in a category be excluded from the loop (2 posts)

  1. csleh
    Posted 8 years ago #

    Can anything be added to this code

    <?php if (in_category('3')) : ?>
    <p class="date">POSTED <?php the_time('F d, Y') ?></p>
    <?php endif; ?>

    that will say "if in category 3 EXCEPT for post 50, show this"

    I tried
    <?php if (in_category('3&exclude=50')) : ?> and (in_category('3&exclude=p50'))
    but that deletes the code on all the posts

  2. csleh
    Posted 8 years ago #

    This title is the wrong question. The answer to the TITLE is: yes. to exclude a post just use this:
    <?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == '179' ) continue; ?>

    Here, post ID 179 will not be included in the listing.

    Will ask the correct question in another post.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.