我使用WP_query或$ wpdb创建以下查询以根据特定层次结构排序所有帖子:
select *
from postTable
where tag = 'tag1'
order by category, tag2, date
union
select *
from nometabella
where tag <> 'tag1'
order by category, 'tag2', date
其中tag1
和tag2
是标记。通过这种方式,帖子按特定顺序显示
(first posts with tag1 grouped by category, tag2 and date, then posts grouped by category and, for each category, they are grouped by tag2 and date)
。
请帮帮我吗?