Title: Filter
Last modified: August 18, 2016

---

# Filter

 *  [l3luemage](https://wordpress.org/support/users/l3luemage/)
 * (@l3luemage)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/filter/)
 * How do I filter the Latest post to only show posts from a certain category?
    
   Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [OthelloBloke](https://wordpress.org/support/users/othellobloke/)
 * (@othellobloke)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/filter/#post-649183)
 * Straight off wordpress loop page – where it says in_category(‘3’), put the category
   ID of ones you DON’T want to show. if you want to restrict more than one, put
 * in_category(‘3’) || in_category(‘4’) || in_category(‘5’)
 *     ```
       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
   
        <!-- If the post is in the category we want to exclude, we simply pass to the next post. -->
        <?php if (in_category('3')) continue; ?>
   
        <div class="post">
   
         <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
   
         <small><?php the_time('F jS, Y'); ?></small>
   
         <div class="entry">
           <?php the_content(); ?>
         </div>
   
         <p class="postmetadata">Posted in <?php the_category(', '); ?></p>
        </div> <!-- closes the first div box -->
   
        <?php endwhile; else: ?>
        <p>Sorry, no posts matched your criteria.</p>
        <?php endif; ?>
       ```
   
 *  Thread Starter [l3luemage](https://wordpress.org/support/users/l3luemage/)
 * (@l3luemage)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/filter/#post-649186)
 * No no I want it to show the title only and possibly date and they click the title
   to go to the post.
 * For example this
 *     ```
       <h2><?php _e('Latest Highlights'); ?></h2>
       	<ul><?php wp_get_archives('type=postbypost&limit=5'); ?></ul>
       ```
   
 * Shows all latest post titles. But I want it to only show the post titles from
   that certain category…and if possible add in the date it was posted also.
 *  [OthelloBloke](https://wordpress.org/support/users/othellobloke/)
 * (@othellobloke)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/filter/#post-649188)
 *     ```
       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
   
        <!-- If the post is in the category we want to exclude, we simply pass to the next post. -->
        <?php if (in_category('3')) continue; ?>
   
         <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
   
         <small><?php the_time('F jS, Y'); ?></small>
   
        <?php endwhile; else: ?>
        <p>Sorry, no posts matched your criteria.</p>
        <?php endif; ?>
       ```
   
 *  Thread Starter [l3luemage](https://wordpress.org/support/users/l3luemage/)
 * (@l3luemage)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/filter/#post-649196)
 * Okay and last thing XD How do you make it so it only shows latest 5? 😐 -is still
   learning all this php stuff haha
 *  [OthelloBloke](https://wordpress.org/support/users/othellobloke/)
 * (@othellobloke)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/filter/#post-649216)
 * Set that in options.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Filter’ is closed to new replies.

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 5 replies
 * 2 participants
 * Last reply from: [OthelloBloke](https://wordpress.org/support/users/othellobloke/)
 * Last activity: [18 years, 7 months ago](https://wordpress.org/support/topic/filter/#post-649216)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
