分类和自定义文章类型订单

问题描述:

我有点失落与这一个。分类和自定义文章类型订单

我想为我的自定义分类标准制作一个索引页,我有99%的工作,但是它忽略了orderby并以张贴的日期顺序显示帖子。

$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但没有...

任何帮助,将不胜感激大大

+0

你看这个问题? http://wordpress.stackexchange.com/questions/14306/using-wp-query-is-it-possible-to-orderby-taxonomy – Benoti

+0

嗯,好像看起来,有点傻,至于我与它合作将是完美的 – Aaron

我猜你要订购的自定义分类..法典可以通过 1)ID 2给出为了分类)计算 3)名称 4)弹头 5)term_group - 无completamente implementado(避免使用) 6)无。 但是没有选择日期。

我想你可以使用 https://wordpress.org/plugins/taxonomy-terms-order/ 这个插件,这是最好的回答对您

谢谢