How to list articles in (bullet style) under a category? (2 posts)

  1. Gary
    Posted 10 years ago #

    This is what my subject says, I have tried searching for it but no results.

    Also if I'm posting a post under any category, is it possible to stop it showing in front page? Just wondering, thanks.

  2. petit
    Posted 10 years ago #

    Passing on your first question, to exclude a category from the front page you introduce the exclusion directly inside the loop of the theme's index.php

    The loop starts something like this:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    To exclude category 4 from the front page, add this
    condition :

    <?php if ( !(in_category('4')) || !is_home() ) { ?>
    <!-- Output the post here -->
    <?php }>

    This means that if on the front page, the post will be presented if it's not in category 4. On pages other than the front ( home ) page, all posts are presented.

    Don't forget to close the if statement
    <php? }>

Topic Closed

This topic has been closed to new replies.

About this Topic