2017-05-18 65 views
0

你好我正在使用自定義帖子類型來顯示計劃。我想自定義項的順序和它的職位,我使用下面的代碼如何設置自定義帖子類型術語和帖子的順序

<?php 
    $plan_group = get_terms('numbers_plans', array(
     'orderby' => 'description', //this is for term order it's working 
     'order' => 'ASC' 
    )); 
    foreach ($plan_group as $plan_group_term) { 
      $plan_group_query = new WP_Query(array(
       'post_type' => 'numbers_plan', 
       'tax_query' => array(
        array(
          'taxonomy' => 'numbers_plans', 
          'field' => 'slug', 
          'terms' => array($plan_group_term->slug) 
         )         
        ) 
       )); 
?> 

誰能告訴我怎樣才能設置我的帖子的訂單。

回答

0

嘿,夥計們,我在下面做了代碼,正在爲我工​​作!

<?php 
    $plan_group = get_terms('numbers_plans', array(
     'orderby' => 'description', 
     'order' => 'ASC' 
    )); 
    foreach ($plan_group as $plan_group_term) { 
     $plan_group_query = new WP_Query(array(
      'post_type' => 'numbers_plan', 
      'meta_key' => 'plan_minutes', 
      'orderby' => '0', 
      'order'  => 'ASC', 
      'tax_query' => array(
       array(
        'taxonomy' => 'numbers_plans', 
        'field' => 'slug', 
        'terms' => array($plan_group_term->slug) 
       ) 
      ) 
     )); 
    ?> 
相關問題