Hide posts in specific topics from index.php
-
If you compare http://www.adailyadventure.com/journal/ with http://www.adailyadventure.com/journal/posts-cats.php You will see the solution in action: This is my edited ‘content’ file
<?php include (‘wp-includes/header.php’) ?>
<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
<?php if (! in_category(9)):?>
CHANGE THE NUMBER IN PARENTHESIS TO THE CATEGORY YOU DO NOT WANT DISPLAYED
<?php the_date(”,'<h2>’,'</h2>’); ?>
<div class=”post”>
<h3 class=”storytitle” id=”post-<?php the_ID(); ?>”>” rel=”bookmark” title=”Permanent Link: <?php the_title(); ?>”><?php the_title(); ?></h3>
<div class=”storycontent”>
<?php the_content(); ?>
</div>
<div class=”feedback”>
<div class=”CommentNumber”>“><?php comments_number(); ?></div>“>Leave a Comment</div>
</div>
Add the below ENDIF statement
<?php endif;?>
<?php endforeach; else: ?>
<?php _e(‘Sorry, no posts matched your criteria.’); ?>
<?php endif; ?>
<div id=”pagination”><?php posts_nav_link() ?></div>
<?php include (‘wp-includes/footer.php’) ?>
The topic ‘Hide posts in specific topics from index.php’ is closed to new replies.