wordpress - How to display only one category in a custom post type? -


i have custom post type called 'portcat' , want display results of 1 portcat category ('games' - has id of '3') on page. below code displays of categories , i'm not sure need add make display 'games' category?

<div class="greyblock">         <h4 class="nomar"><?php echo the_title(); ?></h4>         <div class="sep"></div>              <?php echo $firstcat[0]->cat_name; ?>              <div class="clear"></div>             <ul class="blogpost_list columns3">              <?php             $args = array(             'post_type' => 'port',             'paged' => $paged,             'posts_per_page' => get_theme_option("portfolio_work_count"),             'cat_name' => 'games'             );             $wp_query = new wp_query($args);              ?>             <?php while ( $wp_query->have_posts() ) : $wp_query->the_post();              #we have:             #get_permalink() - full url post;             #get_the_title() - post title;             #get_the_content() - post text;             #get_post_time('u', true) - unix timestamp              $featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->id ), 'single-post-thumbnail' );                  echo "             <li>                     <center><img alt='".get_the_title()."' src='".timthumburl."?w=120&h=250&src=".$featured_image[0]."'>                     <h4>".get_the_title()."</h4></center>";                     $terms = get_the_terms($post->id, 'portcat');                     if ( $terms && ! is_wp_error( $terms ) ) {                      $draught_links = array();                      foreach ( $terms $term ) {                         $draught_links[] = $term->name;                     }                      $on_draught = join( ", ", $draught_links );                     }              echo "             <p>".get_the_excerpt()."</p>                 <center><a href='".get_permalink()."' class='read'>read more</a></center>                                        <br class='clear' />             </li>             ";                 endwhile; ?>          </ul>     </div>     <?php get_pagination() ?>     <?php $wp_query = null; $wp_query = $temp;  ?>   

try changing $args

    $args = array(     'post_type' => 'port',     'paged' => $paged,     'posts_per_page' => get_theme_option("portfolio_work_count"),     'category__in ' => 'games'     ); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -