我想按标题(如“Merecedes”)和从最低到最高的顺序(如“A级”)“ASC”显示所有汽车制造商。它应该看起来像一个词汇表。
页码:汽车。。。
宝马:
1er
2er
3er
。。。
梅赛德斯:
A级
B级
C级
。。。
Z
这是我的custom-port-type-cars.php
<h2>Mercedes</h2>
<?php $args = array( \'post_type\' => \'cars\', \'posts_per_page\' => -1, \'orderby\' => \'title\', \'order\' => \'ASC\',
// ============================= Mercedes ==============================
\'tax_query\' => array(
array(
\'taxonomy\' => \'manufacturer\',
\'field\' => \'slug\',
\'terms\' => array(\'mercedes\')
)
)
);
// ============================= OUTPUT ==============================
$loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post();
the_title(\'<h3>\', \'</h3>\');
the_content();
endwhile; ?>
<h2>BMW</h2>
<?php $args = array( \'post_type\' => \'cars\', \'posts_per_page\' => -1, \'orderby\' => \'title\', \'order\' => \'ASC\',
// ============================= BMW ==============================
\'tax_query\' => array(
array(
\'taxonomy\' => \'manufacturer\',
\'field\' => \'slug\',
\'terms\' => array(\'bmw\')
)
)
);
// ============================= OUTPUT ==============================
$loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post();
the_title(\'<h3>\', \'</h3>\');
the_content();
endwhile; ?>
这对我不起作用。我不能同时订购标题和条款。感谢您的帮助