2013-02-14 6 views
0

나는 우물 사이트를 가지고 있으며 제품에 "제조업체"속성이 있습니다.woocommerce에서 'post_type'=> 'product'사용

내가 단일 제품에 대한 조항 얻을 :

$terms= get_the_terms($product->id,"pa_manufacturer"); 

내가 얻을 :

Array ([230] => stdClass Object ([term_id] => 230 [name] => Dadawan [slug] => dadawan  [term_group] => 0 [term_taxonomy_id] => 230 [taxonomy] => pa_manufacturer [description] => [parent] => 0 [count] => 4 [object_id] => 2905)) 

난은 같은 제조업체에 제품을 얻을 수있는 그 term_id와 루프 WP_query을 할 수 있습니까? 특정 term_id의 제품 만 가져 오려면 어떻게해야합니까? 여기

내 테스트입니다,하지만 ...

$args = array(
'post_type' => 'product', 
'term_id'  => 230 , 
'posts_per_page' => 2, 
'orderby' => $orderby 
); 

$loop = new WP_Query($args); 

// Do stuff here to display your products 

감사 어떤 도움 덕분에 작동하지 않습니다.

답변

2

귀하의 문제점이 있습니다. Term_id는 WP_Query에 사용할 수 없습니다. 다음은 사용 가능한 인수 목록입니다. 목록을 얻었습니다. http://phporlando.com/wp_query-argument-list/

 
attachment 
attachment_id 
author 
author_name 
cat 
category__and 
category__in 
category__not_in 
category_name 
comments_popup 
day 
error 
feed 
hour 
minute 
monthnum 
name 
order 
orderby 
page_id 
page 
paged 
pagename 
post__in 
post__not_in 
post_status 
post_type 
preview 
robots 
sentence 
second 
static 
subpost 
subpost_id 
tag__and 
tag__in 
tag__not_in 
tag_id 
tag_slug__and 
tag_slug__in 
tag 
taxonomy - (pre 3.1) 
tb 
term - (pre 3.1) 
w 
withcomments 
withoutcomments 
year 

Pre WP 3.1 

meta_key 
meta_value 

Since WP 3.1 

fields 
meta_query 
tax_query 
관련 문제