Title: filtering posts
Last modified: August 21, 2016

---

# filtering posts

 *  [cherrydee](https://wordpress.org/support/users/cherrydee/)
 * (@cherrydee)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/filtering-posts-2/)
 *     ```
       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> 
   
                                       <?php
   
                                           $custom = get_post_custom($post->ID);
   
                                           $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); 
   
                                           $cat = get_the_category($post->ID); 
   
                                       ?>
   
                                       <?php $cur_terms = get_the_terms( $post->ID, 'portfolio-category'); 
   
       										foreach($cur_terms as $cur_term){  
   
       									};
   
       									$catt = get_the_terms( $post->ID, 'portfolio-category');
   
       									$slugg = ''; 
   
       									foreach($catt  as $vallue=>$key){
   
       										$slugg .= strtolower($key->slug) . "";
   
       									}
   
       								?>
   
                                           <div class="span4 portfolio_item block <?php echo $slugg; ?> "data-filter="">
   
                                               <div class="view view-first <?php if ($oi_data['portfolio_image_hover_icons'] == "Zoom icon only") { ?>nolink <?php } ?> <?php if ($oi_data['portfolio_image_hover_icons'] == "Link icon only") { ?>noinfo <?php } ?>">
   
                                                   <a href="<?php echo $large_image_url[0]; ?>" rel="prettyPhoto"><img src="<?php echo $large_image_url[0]; ?>" alt="" /></a>
   
                                                   <div class="mask">
   
                                                       <?php if ($oi_data['portfolio_image_hover_icons'] == "Zoom icon + Link icon") { ?>
   
                                                       <a href="<?php echo $large_image_url[0]; ?>" rel="prettyPhoto" title="<?php the_title(); ?>" class="info"></a>
   
                                                       <a href="<?php echo get_permalink(); ?>" class="link"></a>
   
                                                       <?php } ?>
   
                                                       <?php if ($oi_data['portfolio_image_hover_icons'] == "Zoom icon only") { ?>
   
                                                       <a href="<?php echo $large_image_url[0]; ?>" rel="prettyPhoto" title="<?php the_title(); ?>" class="info"></a>
   
                                                       <?php } ?>
   
                                                       <?php if ($oi_data['portfolio_image_hover_icons'] == "Link icon only") { ?>
   
                                                       <a href="<?php echo get_permalink(); ?>" class="link"></a>
   
                                                       <?php } ?>
       ```
   
 * these codes display all the portfolios in a single page. I have 3 sample portfolios
   with different category each. What i want to achieve is to show only the portfolio
   of a certain category. What should i do? I’m not familiar with functions like
   get_post_custom…etc.

The topic ‘filtering posts’ is closed to new replies.

## Tags

 * [filter](https://wordpress.org/support/topic-tag/filter/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [cherrydee](https://wordpress.org/support/users/cherrydee/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/filtering-posts-2/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
