Forums

[Plugin: Exclude Pages] Explude from main page (4 posts)

  1. Amapola
    Member
    Posted 11 months ago #

    Does anyone know of a plugin like this, but kind of in reverse?

    What I mean is I'm trying to find a plugin that will prevent a post from showing up on the main page, but will still allow it to show up under Archive, Categories, and Search.

  2. viceng
    Member
    Posted 11 months ago #

    Hi,

    I just set up a "do not display" category and then modified the loop in index.php as follows:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php if (in_category('16')) continue; ?>

    the do not display category id was 16.

    hope this helps

  3. Amapola
    Member
    Posted 11 months ago #

    That's really cool. Thanks.

    How do you do an "or" in php?

    Would it be something like:

    <?php if(in_category('16') | in_category('17')) continue; ?>

    . . . where 17 is some other category.

    I've taken C++, but I don't really know PHP. I'm not that great at C++ either :-(

  4. simonwheatley
    Member
    Posted 10 months ago #

    <?php if( in_category( 6 ) || in_category( 7 ) ) continue; ?>

    Hope this helps.

    S

Reply

You must log in to post.

About this Topic