在我的wordpress网站上,我想列出按年份订购的艺术品。我目前的策略是每年有一个父类别“作品”和一个子类别“ 2017”,“ 2018”,依此类推。我可以获取父类别,但是我如何按子类别对作品进行排序(年份)?
这是我现在拥有的:
function custom_category_loop() {
// Grab all the categories from the database that have posts.
$categories = get_terms( 'category', 'orderby=name&order=ASC');
// Loop through categories
foreach ( $categories as $category ) {
//categories Works and Exhibitions should be displayed only, and posts sorted by year
if ($category->term_id == 4 or $category->term_id == 5) {
非常感谢您的帮助! (我的头需要刷新:-))
弗雷德