Exclude Categories from the_excerpt (1 post)

  1. bethdean
    Posted 9 years ago #

    I have a static page as my homepage where I display an excerpt from the most recent posts, as opposed to the traditional WordPress index page. What I'm trying to do is exclude posts of a couple different categories from appearing here. My code looks like this:

    <?php $posts = get_posts( "numberposts=1" ); ?>
    <?php if( $posts ) : ?>
         <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
           <div class="entry">
              <?php the_excerpt(); ?>
    		  <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">Read more...</a>
       <?php endforeach; ?>
    <?php endif; ?>

    Any help would be most appreciated, as I'm a PHP noob and there's probably an obvious solution I overlooked.

Topic Closed

This topic has been closed to new replies.

About this Topic