• Hi,
    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>
           </div>
         </div>
       <?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.

  • The topic ‘Exclude Categories from the_excerpt’ is closed to new replies.