2017-12-08 21 views
0

카테고리에 따라 사용자 정의 게시물 유형을 표시해야합니다. 테스트 된 용어가 나열되어 나타나면 해당 분류 체계가 읽혀 지므로 표시 할 게시물을 얻을 수 없습니다.용어로 사용자 정의 게시물 유형 표시

+0

에 오신 것을 환영에 유래하는 https://developer.wordpress.org/reference/functions/get_the_terms/을 통해 응답 코드를 재정비! 저희가 귀하를보다 잘 돕기 위해 질문을 업데이트하여 관련 코드를 [최소한의 완전하고 검증 가능한 예] (https://stackoverflow.com/help/mcve)에 표시하십시오. 자세한 내용은 [좋은 질문을하는 방법] (https://stackoverflow.com/help/how-to-ask)과 관련된 도움말을 참조하십시오. 감사! – dferenc

답변

0

$args = array(
      'posts_per_page' => 30, 
      'post_type' => 'team' 
       ); 

       $q = new WP_Query($args); 

        if ($q->have_posts()) { 
         while ($q->have_posts()) { 
         $q->the_post(); 

         $terms = get_the_terms(get_the_ID(), 'team'); 

         if ($terms && ! is_wp_error('link-to-bio')) { 

          // do stuff 
0

이 시도 :

$args = array(
     'posts_per_page' => 30, 
     'tax_query' => array(
     array(
       'taxonomy' => 'name of your taxonomy', 
       'terms' => 'category id' 
      ), 
     ), 
     'post_type'  => 'team', 
     'post_status'  => 'publish' 
     );