Wordpress,使用永久链接列出自定义帖子类型的所有分类法

Ila*_*sda 2 wordpress taxonomy

有什么简单的方法可以列出具有永久链接的自定义帖子类型的所有分类法?

taxonomy=title&post_type=company

以下内容无法正常工作,仅列出了职位类别:

$args = array (
    'type' => 'company', //your custom post type
    'orderby' => 'name',
    'order' => 'ASC',
    'hide_empty' => 0 //shows empty categories
);
$categories = get_categories( $args );
foreach ($categories as $category) {    
    echo $category->name;
    $post_by_cat = get_posts(array('cat' => $category->term_id));

    echo '<ul>';
    foreach( $post_by_cat as $post ) {
        setup_postdata($post);
        echo '<li><a href="'.the_permalink().'">'.the_title().'</a></li>';
    }
    echo '</ul>';
}
Run Code Online (Sandbox Code Playgroud)

Xhy*_*ynk 5

尝试改变

'type' => 'company', //your custom post type
Run Code Online (Sandbox Code Playgroud)

'post_type' => 'company', //your custom post type
Run Code Online (Sandbox Code Playgroud)