WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Loop + exclude posts from main page (1 post)

  1. Janet Morrow
    Member
    Posted 7 years ago #

    I would like to exclude certain categories from the home page. I have tried the recommended tag:

    <?php if (in_category('3') && is_home() ) continue; ?>

    However, it is not working. Where exactly would I put it? Perhaps that is what I'm doing wrong.

    Here is what I have. Can you please let me know where the above tag would be placed?

    * * * * *

    <div id="rap">
    <div id="content">

    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>

    <div class="post">

    <h3 class="storytitle" id="post-<?php the_ID(); ?>"><?php the_title(); ?></h3>

    <div class="storycontent">
    <?php the_content(); ?>
    </div>

    <!--
    <?php trackback_rdf(); ?>
    -->
    </div>

    <?php endforeach; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>
    </div>

    Thank you,
    Janet

Topic Closed

This topic has been closed to new replies.

About this Topic