Sunday, December 1, 2013

wordpress tax_query where taxonomy

    $terms = get_terms('txnm_project', array('include' => $metaportfolio->peoductinclude));
        foreach($terms as $term){
            $in_area[] = $term->term_id; 
        }
     
   $posts = get_posts(array(
    'post_type'   => 'product',
    
                            'tax_query' => array(
                            array(
                             'taxonomy' => 'txnm_project',
                              'terms' => $page_terms['area_term'] ? $page_terms['area_term'] : $in_area,
                             'field' => 'id',
                               
                            )
                           ),
                         
                        
                               
                                'numberposts' => $metaportfolio->countperpage,
    'order'       => $metaportfolio->sorting ? 'ASC' : 'DESC',
   ));