2016-11-18 6 views
0

私はこの1つで少し失われています。タクソノミーとカスタムポストタイプの注文

注文分類を無視して、投稿された日付順に投稿を表示していますが、私は99%の仕事を持っているカスタム分類のインデックスページを作成しようとしています。

$number_of_posts = intval(get_option('theme_number_posts_agent')); 
$get_county = get_terms( 
    'new_developments', 
    array(
     'orderby' => 'name', 
     'order'  => 'ASC', 
     'hide_empty' => 1, 
    ) 
); 

if(!$number_of_posts){ 
    $number_of_posts = 3; 
} 

foreach ($get_county as $get_countys) { 
    $agents_query = array(
     'post_type'  => 'agent', 
     'posts_per_page' => $number_of_posts, 
     'paged'   => $paged, 
     'orderby'  => 'title', 'order' => 'ASC', 
     'tax_query'  => array(
      array(
       'taxonomy' => 'new_developments', 
       'field' => 'slug', 
       'terms' => $get_countys 
      ) 
     ) 
    ); 

$agent_listing_query = new WP_Query($agents_query); 

if ($agent_listing_query->have_posts()) : 
    while ($agent_listing_query->have_posts()) : 
     $agent_listing_query->the_post(); 

私は

... get_terms下とwp_query何もして2箇所にorderbyの置かれているすべてのヘルプは大

+0

ありがとう? http://wordpress.stackexchange.com/questions/14306/using-wp-query-is-it-possible-to-orderby-taxonomy – Benoti

+0

hmmm okは、私がそれと一緒に作業しているものが完璧であるように少しばかげているようです – Aaron

答えて

0

私はあなたがカスタム分類を注文したいと思いいただければ幸いです。.. (使用を避ける) 6)なしなしcompletamenteのimplementado - コーデックスでは、 3)名称 4)スラッグ 5)term_groupをカウントしない) 1)ID 2により分類に秩序を与えることができます。 しかし、日付のオプションはありません。

私はあなたがこれはあなた

ための最良の答えです https://wordpress.org/plugins/taxonomy-terms-order/ このプラグインを使用することができますねあなたがこの質問を読んでなかった

関連する問題