最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

posts - Create a tree with categories with get_posts()

programmeradmin6浏览0评论

I have my posts using this code :

$dataQuery = [
    'numberposts'   => -1,
    'post_type'     => 'documentation',
    'meta_query'    => $meta_query,
];

$documentations = get_posts($dataQuery);

Where $meta_query is an array. It's working, I have my posts, but I want to show a tree with the categories and the posts inside ? Is it possible easily ?

For now, I will get my categories and loop over them and then get posts for each category... Since get_posts() doesn't return any information about the category. I guess there is a better way ?

发布评论

评论列表(0)

  1. 暂无评论