If you need to hide (exclude) posts belonging to a certain category from displaying on the front page, you can place code that does the exclusion inside The Loop of your theme's index.php file.

The Loop starts something like this:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

To exclude category 4 from the front page, just inside The Loop, add this condition :

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

The Loop ends something like this:

<?php endwhile; ?>

Just before that line, add this:

<?php } ?>

In the end, it will look like:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if ( !(in_category('4')) || !is_home() ) { ?>
<!-- Output the post here -->
<?php } ?>
<?php endwhile; ?>

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.

Posted in: WordPress

Related FAQ's

Marius Ion ANGEL HOT SOFT LLC (800) 316-7677